internal static Hashtable MDIFormLists = new Hashtable();
#region OpenMDIForm
public static Form OpenMDIForm(System.Type type, Form owner)
{
return OpenMDIForm(type, owner, true);
}
public static Form OpenMDIForm(System.Type type, Form owner, string ModuleCode)
{
return OpenMDIForm(type, owner, true, ModuleCode);
}
public static Form OpenMDIForm(System.Type type, Form owner, bool active)
{
return OpenMDIForm(type, owner, null, active, "");
}
public static Form OpenMDIForm(System.Type type, Form owner, bool active, string ModuleCode)
{
return OpenMDIForm(type, owner, null, active, ModuleCode);
}
public static Form OpenMDIForm(System.Type type, Form owner, object[] args)
{
return OpenMDIForm(type, owner, args, true);
}
public static Form OpenMDIForm(System.Type type, Form owner, object[] args, string ModuleCode)
{
return OpenMDIForm(type, owner, args, true, ModuleCode);
}
public static Form OpenMDIForm(System.Type type, Form owner, object[] args, bool active)
{
return OpenMDIForm(type, owner, args, active, "");
}
public static Form OpenMDIForm(System.Type type, Form owner, object[] args, bool active, string ModuleCode)
{
Form form;
if(MDIFormLists.ContainsKey(type))
{
form = MDIFormLists[type] as Form;
if(active)
{
if(form.WindowState==FormWindowState.Minimized)
{
form.WindowState = FormWindowState.Normal;
}
form.Activate();
}
}
else
{
form = CreateForm(type, args);
form.MdiParent = owner;
if(active)
form.Show();
}
return form;
}
#endregion
#region CreateForm
public static Form CreateForm(System.Type type)
{
return CreateForm(type, null);
}
public static Form CreateForm(System.Type type, object[] args)
{
Form form;
if(args==null || args.Length<=0)
form = Activator.CreateInstance(type) as Form;
else
form = Activator.CreateInstance(type, args) as Form;
return form;
}
#endregion