In splitContainerControl,is it possible to set the property of 2 panels ,with one occupy one third other two thirds?or should i adjust by hand?thank you very much

Answered In splitContainerControl,is it possible to set the property of 2 panels ,with one occupy one third other two thirds?or should i adjust by hand?thank you very much

  • Monday, August 20, 2012 9:03 AM
     
     
    Hi,i would like to ask in splitContainerControl,is it possible to set the property of 2 panels ,with one occupy one third other two thirds?or should i adjust by hand?thank you very much

    is there anyone can do me a favor to help me?

    thank u very much for your kindness in advance

    best regards

    martin

All Replies

  • Monday, August 20, 2012 9:13 AM
     
     

    or i can say,how can directly set the size of the panel?coz i found in the property the size is fixed.

    thank u

  • Monday, August 20, 2012 10:29 PM
     
     Answered Has Code

    Hi,

    set the SplitterDistance once in the Properties-Window, set also the IsSplitterFixed - Property to true. Now, when resizing the form, the panels stay at the same relative size:

        public partial class Form1 : Form
        {
            private System.Windows.Forms.SplitContainer splitContainer1 = new System.Windows.Forms.SplitContainer();
    
            public Form1()
            {
                InitializeComponent();
    
                this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.splitContainer1.IsSplitterFixed = true;
                this.splitContainer1.Location = new System.Drawing.Point(0, 0);
                this.splitContainer1.Name = "splitContainer1";
                this.splitContainer1.Size = new System.Drawing.Size(284, 262);
                this.splitContainer1.SplitterDistance = 94;
                this.splitContainer1.TabIndex = 0;
    
                this.ClientSize = new System.Drawing.Size(284, 262);
                this.Controls.Add(this.splitContainer1);
            }
        }

    Regards,

      Thorsten

    • Proposed As Answer by Ante Meridian Monday, August 20, 2012 11:12 PM
    • Marked As Answer by martinwang1985 Tuesday, August 21, 2012 7:04 AM
    •  
  • Tuesday, August 21, 2012 7:04 AM
     
     

    hi Thorsten Gudera

       Thank u very much for ur kindness help

    best regards

    martin