日期:2014-05-17 浏览次数:21087 次
private void Disposed()
{
for (int i = 0; i < panel1.Controls.Count; i++)
{
panel1.Controls[i].Dispose();
}
panel1.Controls.Clear();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
var o = e.Node.Tag;
if (o!=null)
{
string frmName = o.ToString();
Form f = GetFrom(frmName);
if (f!=null)
{
Disposed();
f.FormBorderStyle = FormBorderStyle.None;
f.TopLevel = false;
f.Dock = System.Windows.Forms.DockStyle.Fill;
panel1.Controls.Add(f);
f.Show();
}
}
}
private Form GetFrom(string a)
{
Form newform = null;
try
{
newform = (Form)Assembly.Load("WindowsForms").CreateInstance("WindowsForms."+a);