最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Win Form 的 Splitter 使用心得與技巧

 更新時(shí)間:2007年04月13日 00:00:00   作者:  
今天作個(gè)分析html代碼,然后再批量下載的程序,其中用到 Splitter (分割條),編譯程序后,發(fā)現(xiàn)分割條不起作用,拖動(dòng)分割條的時(shí)候,相鄰的兩個(gè) Panel 沒(méi)有變換大小。為這個(gè)幾乎花了一天時(shí)間,也沒(méi)找到原因。包括到其他機(jī)子上測(cè)試。
后來(lái),再次作一個(gè)完全獨(dú)立的測(cè)試項(xiàng)目,發(fā)現(xiàn) Splitter 的使用有個(gè)算是 bug 的問(wèn)題,如果你首先放兩個(gè) Panel ,然后再放一個(gè) Splitter 。(注意這時(shí)候的次序)就會(huì)產(chǎn)生我上面出現(xiàn)的問(wèn)題。這時(shí)候代碼中的 InitializeComponent 函數(shù)部分代碼如下:
復(fù)制代碼 代碼如下:

private void InitializeComponent() 

// 
// ... 其他代碼 
// 
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(); 
// 
// ... 其他代碼 
// 
//  
// panel1 
//  
this.panel1.Dock = System.Windows.Forms.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 = "站點(diǎn)下載工具 2003年9月21日"; 
this.panel2.ResumeLayout(false); 
this.ResumeLayout(false); 


注意:這時(shí)候的代碼中的順序。這時(shí)候,程序的執(zhí)行是有問(wèn)題的。分隔條會(huì)不起作用。
但是如果你把這三個(gè)控件放入順序修改為下面的順序就沒(méi)有問(wèn)題了。
1、放入一個(gè) Panel 比如:panel1 然后設(shè)置他的 Dock 屬性為:Left; 
2、放入一個(gè) Splitter 比如:splitter1 設(shè)置它的背景顏色為一個(gè)特殊的顏色,便于看執(zhí)行效果;
3、放入一個(gè) Panel 比如:panel2 然后設(shè)置他的 Dock 屬性為:Fill; 
4、編譯執(zhí)行程序,這時(shí)候就沒(méi)有問(wèn)題了。
這時(shí)候正確的代碼應(yīng)該是:( InitializeComponent 函數(shù)部分) 
 
復(fù)制代碼 代碼如下:

private void InitializeComponent() 

// 
// ... 其他代碼 
// 
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(); 
// 
// ... 其他代碼 
// 
//  
// panel1 
//  
this.panel1.Dock = System.Windows.Forms.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 = "站點(diǎn)下載工具 2003年9月21日"; 
this.Load += new System.EventHandler(this.Form1_Load); 
this.panel2.ResumeLayout(false); 
this.ResumeLayout(false); 

相關(guān)文章

最新評(píng)論

安平县| 乐安县| 丰镇市| 大田县| 南安市| 昌乐县| 万州区| 天水市| 稷山县| 赣州市| 虹口区| 南靖县| 涿州市| 慈溪市| 甘孜| 安图县| 门头沟区| 专栏| 洱源县| 开平市| 呼玛县| 米林县| 平罗县| 墨江| 钦州市| 大丰市| 固原市| 济宁市| 江达县| 乡宁县| 中方县| 永年县| 许昌县| 恭城| 湖南省| 图们市| 精河县| 宁化县| 茂名市| 同心县| 斗六市|