private void Form1_Load(object sender, EventArgs e)
{
Panel panel = new Panel();
panel.Width = (int)(this.Width * 0.8);
panel.Height = (int)(this.Height * 0.8);
panel.Location = new Point(10, 10);
panel.BackColor = Color.Red;
panel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
this.Controls.Add(panel);
}
[C#]代码行设置控件Anchor属性
于 2020-04-16 15:42:00 首次发布