首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎样使winform中button位于底部解决方法

2012-03-04 
怎样使winform中button位于底部winform中动态增加控件,winform的长度也随之动态增加,请问怎样才能使button

怎样使winform中button位于底部
winform中动态增加控件,winform的长度也随之动态增加,请问怎样才能使button永久位于winform的底部?

[解决办法]
try:

Button1.Dock = DockStyle.Bottom
[解决办法]
设置anchor属性 就可解决
[解决办法]
觉得使用Anchor合适,我的代码如下:

Button btn = new Button();
btn.Text = "测试按钮 ";
btn.Location = new Point(this.ClientRectangle.Width - btn.Width, this.ClientRectangle.Height - btn.Height);
btn.Anchor = AnchorStyles.Bottom| AnchorStyles.Right;
this.Controls.Add(btn);

热点排行