情况是这样的,我重写了一个button类,想代码添加到Form中,其他都正常,只是anchor属性除了问题
class myButton:System.Windows.Forms.Button
{
}
构造函数中我这么写,当然语法没错mybutton = new myButton();
this.mybutton.Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);但是运行出来的结果是:mybutton没有随着窗体的大小改变~~~
各位大侠,帮忙看下吧~~~小弟谢过了~~~
class myButton:System.Windows.Forms.Button
{
}
构造函数中我这么写,当然语法没错mybutton = new myButton();
this.mybutton.Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);但是运行出来的结果是:mybutton没有随着窗体的大小改变~~~
各位大侠,帮忙看下吧~~~小弟谢过了~~~
设置left, right,bottom才有效
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));