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

如题所述

第1个回答  推荐于2019-10-01
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 = "按钮上的文字";本回答被网友采纳