-2

SplitContainterMDI 親フォームで使用しています。

私の問題は、First Formpanel1という名前のフォームをロードしたことです。この最初のフォームにはボタンがあり、panel2 にロードします。 SecondForm

私はこのコードを使用しています:

        Form In_but = new SecondForm();
        In_but.MdiParent = this.ParentForm;
        In_but.TopLevel = false;
        this.splitContainer1.Panel2.Controls.Add(In_but);
        In_but.Show();

しかし、それは機能していません。エラー: does not contain definition splitContainer1

4

3 に答える 3

0

From looking at your code sample, I suspect your problem is when you refer to this.splitContainer, this is your 'First form' on panel 1, and your SplitContainer is on this.ParentForm.

I'd suggest changing that line to this.(ParentForm as <whatever class your parent form is>).splitContainer1.Panel2.Controls.Add(In_but);

于 2012-06-12T08:18:12.303 に答える
0

これを試して

frmChild frmChild = new frmChild();
        frmChild.TopLevel = false;
        frmChild.Parent = this.splitContainer3.Panel2;
        frmMasterlistAdministrationAdd.Show();
于 2012-12-15T07:07:46.977 に答える
-1
frmTest fs = new frmTest();  //frmTest is the form that you going to call 

fs.MdiParent = this; //the main form is a mdiform and have a splitcontainer with 
                     //two panels

this.splitContainer1.Panel2.Controls.Add(fs); //add the fs form to the panel2

fs.Show(); //show the form
于 2012-09-28T17:25:21.500 に答える