在winform中怎样用代码改变button控件的上下位置?
发布网友
发布时间:2022-04-22 14:59
我来回答
共1个回答
热心网友
时间:2023-05-18 15:28
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 = "按钮上的文字";