您的位置:首页 > 编程语言 > C#

C#巧用anchor和dock设计复杂界面(控件随着窗体大小的变化而变化)

2009-06-16 15:38 711 查看
窗体不变,panel1和pannel2相对变化,button也变化
private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{
int length = this.tabControl1.Width / 4;
int s = length * 3 / 4;

button3.Width = s;
button4.Width = s;
button5.Width = s;
button6.Width = s;
button4.Location = new Point(button3.Location.X + length, button3.Location.Y);
button5.Location = new Point(button4.Location.X + length, button4.Location.Y);
button6.Location = new Point(button5.Location.X + length, button5.Location.Y);
}

经过如上设置,我们的窗体界面就设计好了。我还是菜鸟,有理解不对的地方,还恳请大家指证。
15:30:11

源码可以到http://finallyliuyu.download.csdn.net/下载

没有CSDN号的朋友可以http://www.cnblogs.com/finallyliuyu/admin/Files.aspx下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: