在winform中怎样用代码改变button控件的上下位置

如题所述

this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//这段是最大化以后,控件是怎么“停靠”的。
this.button1.Location = new System.Drawing.Point(12, 323); //控件坐标
this.button1.Name = "button1"; //不解释
this.button1.Size = new System.Drawing.Size(367, 23);//控件大小
this.button1.TabIndex = 1;
this.button1.Text = "按钮上的文字";
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-12-23
上下位置 ?本回答被网友采纳
第2个回答  2010-12-23
可以通过button.Location.X和button.Location.Y来修改button左上角的坐标来改变位置本回答被提问者采纳