JD2022-TU1/main/tools/legacy/MemoryViewer/TabUser.cs

64 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MemoryViewer
{
public class TabUser
{
public TabUser(FormMemoryViewer _parent, string _className, string _caption)
{
m_caption = _caption;
m_parent = _parent;
m_className = _className;
}
public void close()
{
if (m_associatedForm != null)
{
m_associatedForm.Visible = false;
m_associatedForm.Dispose();
m_associatedForm = null;
}
}
public void show()
{
if (m_className == null)
return;
if (m_associatedForm != null && m_associatedForm.Visible == true)
{
m_associatedForm.Visible = false;
m_associatedForm = null;
}
else
{
m_associatedForm = (Form)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("MemoryViewer." + m_className);
if (m_associatedForm != null)
{
int top = m_parent.Height + m_parent.Top;
m_associatedForm.Location = new System.Drawing.Point(m_parent.Left, top);
m_associatedForm.Text = m_caption;
m_associatedForm.StartPosition = FormStartPosition.Manual;
m_associatedForm.Tag = m_parent.m_callbackAction;
m_parent.currentFormTab = m_associatedForm;
m_associatedForm.Visible = true; //keep always at the end
}
}
}
protected FormMemoryViewer m_parent = null;
protected Form m_associatedForm = null;
protected string m_className = null;
protected string m_caption = null;
}
}