Win Form's splitter use experience
Today, I analyzed HTML code, then download the program that downloaded, in which the splitter (split bar), after the compiler, found that the split bar does not work, when the division is dragged, the adjacent two panels have no transformation size. . I have brought this almost a day and didn't find the reason. Includes testing to other machines.
Later, once again made a completely independent test project, found that the use of splitter is a bug problem, if you first put two PANEL, then put a splitter. (Note this time) will generate the problem that I have appeared above. At this time, the INITIALIZECMPONENT function part of the code is as follows:
Private vidinitiRizeComponent ()
{
//
// ... other code
//
This.Panel1 = new system.windows.Forms.Panel ();
This.Panel2 = new system.windows.Forms.Panel ();
This.Splitter1 = new system.windows.forms.splitter ();
this.Panel2.suspendlayout ();
THIS.SUSPENDLAYOUT ();
//
// ... other code
//
//
// panel1
//
This.Panel1.dock = system.windows.Forms.dockStyle.Lorms.dockStyle.Left;
This.Panel1.Location = new system.drawing.point (0, 42);
this.Panel1.name = "panel1";
This.Panel1.size = new system.drawing.size (120, 209);
This.Panel1.tabindex = 6;
This.Panel1.resize = new system.eventhandler (this.Panel2_resize);
This.Panel1.paint = new system.windows.Forms.PainteventHandler (this.Panel2_paint);
//
// panel2
//
This.Panel2.controls.add (this.splitter1);
This.Panel2.dock = system.windows.Forms.dockStyle.Fill;
This.Panel2.Location = new system.drawing.point (120, 42);
this.Panel2.name = "panel2";
This.Panel2.size = new system.drawing.size (328, 209);
this.Panel2.tabindex = 7;
This.Panel2.resize = new system.eventhandler (this.Panel2_resize);
This.Panel2.paint = new system.windows.forms.painteventhandler (this.Panel2_paint);
//
// splitter1
//
THIS.SPLITTER1.BACKCOLOR = system.drawing.systemcolors.desktop;
This.Splitter1.Location = new system.drawing.point (0, 0); this.splitter1.name = "splitter1";
This.Splitter1.size = new system.drawing.size (3, 209);
this.Splitter1.tabindex = 0;
THIS.SPLITTER1.TABSTOP = FALSE;
//
// Form1
//
THIS.AUTOSCALEBASESIZE = New System.drawing.size (5, 13);
This.ClientSize = New System.drawing.size (448, 273);
This.Controls.add (this.Panel2);
This.Controls.add (this.Panel1);
This.Controls.add (this.toolbar1);
This.Controls.add (this.statusbar1);
THIS.NAME = "Form1";
THIS.TEXT = "Site Download Tool September 21, 2003";
This.Panel2.ResumeLayout (false);
This.ResumeLayout (false);
}
Note: The order in this code is. At this time, the execution of the program is problematic. The separator will not work.
But if you put these three controls into the order in order, there is no problem. 1. Put a panel such as: Panel1 and then set his dock attribute to: left; 2, put in a splitter such as: splitter1 Setting its background color is a special color, easy to see the effect; 3, put a panel For example: Panel2 then sets his Dock attribute as: Fill; 4, compiling executives, there is no problem at this time.
At this time, the correct code should be: (InitializationComponent function section)
Private vidinitiRizeComponent ()
{
//
// ... other code
//
This.Panel1 = new system.windows.Forms.Panel ();
This.Panel2 = new system.windows.Forms.Panel ();
This.Splitter1 = new system.windows.forms.splitter ();
this.Panel2.suspendlayout ();
THIS.SUSPENDLAYOUT ();
//
// ... other code
//
//
// panel1
//
This.Panel1.dock = system.windows.Forms.dockStyle.Lorms.dockStyle.Left;
This.Panel1.Location = new system.drawing.point (0, 42);
this.Panel1.name = "panel1";
This.Panel1.size = new system.drawing.size (200, 209);
This.Panel1.tabindex = 6;
//
// panel2
//
This.Panel2.controls.add (this.splitter1);
This.Panel2.dock = system.windows.Forms.dockStyle.Fill;
This.Panel2.Location = new system.drawing.point (200, 42); this.Panel2.name = "panel2";
This.Panel2.size = new system.drawing.size (248, 209);
this.Panel2.tabindex = 7;
//
// splitter1
//
THIS.SPLITTER1.BACKCOLOR = system.drawing.systemcolors.desktop;
This.Splitter1.Location = new system.drawing.point (0, 0);
This.Splitter1.name = "splitter1";
This.Splitter1.size = new system.drawing.size (3, 209);
this.Splitter1.tabindex = 0;
THIS.SPLITTER1.TABSTOP = FALSE;
//
// Form1
//
THIS.AUTOSCALEBASESIZE = New System.drawing.size (5, 13);
This.ClientSize = New System.drawing.size (448, 273);
This.Controls.add (this.Panel2);
This.Controls.add (this.Panel1);
This.Controls.add (this.toolbar1);
This.Controls.add (this.statusbar1);
THIS.MENU = this.mainMenu1;
THIS.NAME = "Form1";
THIS.TEXT = "Site Download Tool September 21, 2003";
This.Load = New System.EventHandler (this.form1_load);
This.Panel2.ResumeLayout (false);
This.ResumeLayout (false);
}
The execution environment of my program is Win2003 standard English version vs.net 2003 Chinese version