MID Form 이란? Multiple Document Interface의 약자로 간략하게 설명을 하자면
한폼안에 여러게의 폼을 또 생성하는 거다.
즉, 한글 프로그램을 보면 여러 문서를 뛰우지 않는가? 그렇게
생각 하자!!
C# 으로 MDI Form을 만들어 봅시다.
힌트;;;
-------------------------------------------------------------------
Child Form에서
public MainForm mainForm;
public void Initialize()
{
this.Location = new Point(0, 0);
this.StartPosition = FormStartPosition.Manual;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Normal;
this.Dock = DockStyle.Fill;
}
Main Form 에서...
버튼 클릭시
private void toolBarCreatePlan_Click(object sender, EventArgs e)
{
ICS.IssuePlan.frmCreatePlan form = new ICS.IssuePlan.frmCreatePlan();
if (ToolBarShow(form) == false)
{
form.Text = "발급계획수립";
//////form.issuePlanList = _IssuePlanList;
ShowMdiForm(form, form.Text, form.Text);
}
}
public void ShowMdiForm(Common.ChildForm form, string state, string title)
{
form.Location = new Point(0, 0); ;
form.StartPosition = FormStartPosition.Manual;
form.FormBorderStyle = FormBorderStyle.None;
form.WindowState = FormWindowState.Normal;
ICS.Common.ChildForm forms = new ICS.Common.ChildForm();
form.mainForm = this;
form.MdiParent = this;
form.remote = this._remoting;
form.commFunc = this.commonFunc;
form.Text = title;
form.Closed += new EventHandler(MainForm.ProgressMain.formCloseEvent);
form.Show();
SetTitleBar(title);
}
#region ToolBarShow : ToolBar 클릭시 Form 생성 유무 확인
public bool ToolBarShow(object form)
{
for (int i = 0; i < this.MdiChildren.Length; i++)
{
if (this.MdiChildren[i].GetType().ToString().Equals(form.GetType().ToString()) == true)
{
this.MdiChildren[i].BringToFront();
return true;
}
}
return false;
}
#endregion
public void SetTitleBar(string title)
{
//local Host Ip/Name 가져오기
string hostIpName = GetHostIpName();
if (hostIpName != "")
{
hostIpName = " [ " + hostIpName + " ]";
}
if (title != null && title != "")
this.Text = "발급 제어 시스템(ICS)" + " - " + title + hostIpName;
else
this.Text = "발급 제어 시스템(ICS)" + " " + hostIpName;
}
#endregion
-----------------------------------------------------------------------