2013-12-11 3 views
-1

MDI를 사용하여 이와 같은 작업을하고 싶지만 어떻게 작동하는지 알고 싶지는 않습니다. 이제 캐스케이드 모드에서만 하위 항목이 있습니다. 내 고향에서여유 공간이없는 MDI 자식 폼

enter image description here

다시 크리스마스에서

임, 매일 작업을 시작합니다. :)

나는 반드시 SuspendLayout과 ISupportIntialize가 필요합니까?

SuspendLayout 및 ISupportIntialize 또는 FixedPanel 사용 방법을 배웁니다. 그래서 나는이 내가 [선택 경우]를 사용하려고 1/2/3/4 패널 디스플레이 모드 사이의 자동 검사를 위해

http://i.stack.imgur.com/Wltvd.png

을 :) 않습니다.

 public partial class MainForm : Form 
{    
     Child1Form1 Test1 = new Child1Form1(); 
     Child1Form2 Test2 = new Child1Form2(); 
     Child1Form3 Test3 = new Child1Form3(); 
     Child1Form4 Test4 = new Child1Form4(); 

    public MainForm() 
    { 
     InitializeComponent(); 

     this.AutoSizeMode = AutoSizeMode.GrowAndShrink; 
     this.SizeGripStyle = SizeGripStyle.Show; 
     // 
     // splitContainer1 
     // 
     //this.splitContainer1.Dock = DockStyle.Fill; 
     this.splitContainer1.FixedPanel = FixedPanel.Panel1; 
     this.splitContainer1.FixedPanel = FixedPanel.Panel2; 
     this.splitContainer1.Panel1.Controls.Add(splitContainer2); 
     this.splitContainer1.Panel2.Controls.Add(splitContainer3); 
     // 
     // splitContainer2 
     // 
     //this.splitContainer2.Dock = DockStyle.Fill; 
     this.splitContainer2.FixedPanel = FixedPanel.Panel1; 
     this.splitContainer2.FixedPanel = FixedPanel.Panel2; 
     this.splitContainer2.Panel1.Controls.Add(Test1); 
     this.splitContainer2.Panel2.Controls.Add(Test2); 
     // 
     // splitContainer3 
     // 
     //splitContainer3.Dock = DockStyle.Fill; 
     this.splitContainer3.Panel1.Controls.Add(Test3); 
     this.splitContainer3.Panel2.Controls.Add(Test4); 
     this.Test1.Dock = DockStyle.Fill; 
     this.Test2.Dock = DockStyle.Fill; 
     this.Test3.Dock = DockStyle.Fill; 
     this.Test4.Dock = DockStyle.Fill; 
     } 


    private void Form1_Load(object sender, EventArgs e) 
    { 
     this.Test1.Show(); 
     this.Test2.Show(); 
     this.Test3.Show(); 
     this.Test4.Show(); 
    } 
    private void splitContainer1_Resize(object sender, EventArgs e) 
    { 
     this.Test1.Dock = DockStyle.Fill; 
     this.Test2.Dock = DockStyle.Fill; 
     this.Test3.Dock = DockStyle.Fill; 
     this.Test4.Dock = DockStyle.Fill; 
    } 
+0

propestipes.DOCK을하지만 난 더 결합해야 meyby, 지금은 모르겠어요 디자이너가 완료되면 귀하의 InitializeComponent 방법은 다음과 비슷한 모습이 될 것입니다. – Vanguard1990

+0

음, 분명히 당신은 MDI를 원하지 않습니다. WeiFen Luo의 DockPanelSuite는 인기가 있고 적절한 가격입니다. –

+0

Peter는 WinForms를 사용하는 경우 영감/솔루션으로 사용할 수있는 답변을 제공합니다. WinForms 대신 WPF를 사용한다면 ... – elgonzo

답변

0

한 가지 방법은 그것을 할 수 있습니다 : ChildForm1-4의 경우, 폼에 하나 SplitContainer를 추가 한 후 첫 번째 분할 컨테이너의 각 패널에 두 SplitContainer의를 추가하고 HorizontalOrientation을 설정합니다. 다음 상단 패널에 다른 SplitContainer를 추가하고 떠나

ChildForm1-3의 경우
private void InitializeComponent() 
    { 
     this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 
     this.splitContainer2 = new System.Windows.Forms.SplitContainer(); 
     this.splitContainer3 = new System.Windows.Forms.SplitContainer(); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 
     this.splitContainer1.Panel1.SuspendLayout(); 
     this.splitContainer1.Panel2.SuspendLayout(); 
     this.splitContainer1.SuspendLayout(); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); 
     this.splitContainer2.SuspendLayout(); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); 
     this.splitContainer3.SuspendLayout(); 
     this.SuspendLayout(); 
     // 
     // splitContainer1 
     // 
     this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.splitContainer1.Location = new System.Drawing.Point(0, 0); 
     this.splitContainer1.Name = "splitContainer1"; 
     // 
     // splitContainer1.Panel1 
     // 
     this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); 
     // 
     // splitContainer1.Panel2 
     // 
     this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); 
     this.splitContainer1.Size = new System.Drawing.Size(678, 410); 
     this.splitContainer1.SplitterDistance = 226; 
     this.splitContainer1.TabIndex = 0; 
     // 
     // splitContainer2 
     // 
     this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.splitContainer2.Location = new System.Drawing.Point(0, 0); 
     this.splitContainer2.Name = "splitContainer2"; 
     this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; 
     this.splitContainer2.Size = new System.Drawing.Size(226, 410); 
     this.splitContainer2.SplitterDistance = 75; 
     this.splitContainer2.TabIndex = 0; 
     // 
     // splitContainer3 
     // 
     this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.splitContainer3.Location = new System.Drawing.Point(0, 0); 
     this.splitContainer3.Name = "splitContainer3"; 
     this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; 
     this.splitContainer3.Size = new System.Drawing.Size(448, 410); 
     this.splitContainer3.SplitterDistance = 149; 
     this.splitContainer3.TabIndex = 0; 
     // 
     // Form1 
     // 
     this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
     this.ClientSize = new System.Drawing.Size(678, 410); 
     this.Controls.Add(this.splitContainer1); 
     this.Name = "Form1"; 
     this.Text = "Form1"; 
     this.splitContainer1.Panel1.ResumeLayout(false); 
     this.splitContainer1.Panel2.ResumeLayout(false); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 
     this.splitContainer1.ResumeLayout(false); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); 
     this.splitContainer2.ResumeLayout(false); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); 
     this.splitContainer3.ResumeLayout(false); 
     this.ResumeLayout(false); 

    } 

양식 한 SplitContainer를 추가하고 HorizontalOrientation 설정 : 다음과 비슷한 모습이 될 것입니다 귀하의 InitializeComponent 방법은 디자이너가 완료되면 OrientationVertical입니다.

private void InitializeComponent() 
    { 
     this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 
     this.splitContainer2 = new System.Windows.Forms.SplitContainer(); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 
     this.splitContainer1.Panel1.SuspendLayout(); 
     this.splitContainer1.SuspendLayout(); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); 
     this.splitContainer2.SuspendLayout(); 
     this.SuspendLayout(); 
     // 
     // splitContainer1 
     // 
     this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.splitContainer1.Location = new System.Drawing.Point(0, 0); 
     this.splitContainer1.Name = "splitContainer1"; 
     this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; 
     // 
     // splitContainer1.Panel1 
     // 
     this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); 
     this.splitContainer1.Size = new System.Drawing.Size(678, 410); 
     this.splitContainer1.SplitterDistance = 226; 
     this.splitContainer1.TabIndex = 0; 
     // 
     // splitContainer2 
     // 
     this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.splitContainer2.Location = new System.Drawing.Point(0, 0); 
     this.splitContainer2.Name = "splitContainer2"; 
     this.splitContainer2.Size = new System.Drawing.Size(678, 226); 
     this.splitContainer2.SplitterDistance = 226; 
     this.splitContainer2.TabIndex = 0; 
     // 
     // Form1 
     // 
     this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
     this.ClientSize = new System.Drawing.Size(678, 410); 
     this.Controls.Add(this.splitContainer1); 
     this.Name = "Form1"; 
     this.Text = "Form1"; 
     this.splitContainer1.Panel1.ResumeLayout(false); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 
     this.splitContainer1.ResumeLayout(false); 
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); 
     this.splitContainer2.ResumeLayout(false); 
     this.ResumeLayout(false); 

    }