를 사용.NET SplitContainer가 나는 C#을 윈도우 응용 프로그램에서 SplitContainer가 도구를 사용하고 C#을
내가나는이 어떻게 할 수있는
splited 컨테이너 패널에서 다른 형태에 대해 하나의 양식을 대체 할? 내가 From1 작품에서하고 싶은
은 ... 작동하고 From2 보여 .. splited 컨테이너 패널의 같은 장소를 교체 완료
하지만이 코드가 작동하지 않습니다 ...public partial class Parent : Form{public Parent()
{
InitializeComponent();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode node = treeView1.SelectedNode;
if (node.Text.ToString().Equals("Control1"))
{
//MessageBox.Show(node.ToString());
//Control1 conr1 = new Control1();
ShowForm(1);
}
else if (node.Text.ToString().Equals("Control2"))
{
//MessageBox.Show(node.ToString());
//Control2 conr2 = new Control2();
ShowForm(2);
}
}
public void ShowForm(int id)
{
Form childObj = null;
if (id == 1)
{
childObj = new Control1();
}
else
{
childObj = new Control2();
}
childObj.TopLevel = false;
childObj.Visible = true;
childObj.Parent = this.splitContainer1.Panel2;
this.splitContainer1.Panel2.Controls.Clear();
this.splitContainer1.Panel2.Hide();
this.splitContainer1.Panel2.Controls.Add(childObj);
this.splitContainer1.Panel2.Show();
childObj.Show();
}
public Control2()
{
InitializeComponent();
}
Parent bioAdMainForm = new Parent();
private void button1_Click(object sender, EventArgs e)
{
//Control1 enrollmentForm = new Control1();
//this.Hide();
//enrollmentForm.Show();
bioAdMainForm.ShowForm(1);
}
항상 '작동하지 않음'을 설명하십시오. –
패널에 양식을 추가하는 것에 대해 들어 본 적이 없다 ... 패널을 사용하는 것이 좋습니다. – Stig
'SplitContainer'에'Form'을 넣으시겠습니까? 'Form' 대신에'UserControl'의 자손을 배치하십시오. – Dennis