111,044
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
Button btn1 = null;
Button btn2 = null;
Button btn3 = null;
private void Form1_Load(object sender, EventArgs e)
{
btn1 = new Button();
btn2 = new Button();
btn3 = new Button();
btn1.Size = new Size(150, 50);
btn2.Size = new Size(150, 50);
btn3.Size = new Size(150, 50);
btn1.Location = new Point(5, 5);
btn2.Location = new Point(btn1.Right + 5, 5);
btn3.Location = new Point(btn2.Right + 5, 5);
btn1.Text = "Red";
btn2.Text = "0, 255, 0";
btn3.Text = "Transparent";
this.Controls.AddRange(new Control[] { btn1, btn2, btn3 });
this.btn1.Click += new EventHandler(btn_Click);
this.btn2.Click += new EventHandler(btn_Click);
this.btn3.Click += new EventHandler(btn_Click);
}
void btn_Click(object sender, EventArgs e)
{
this.TransparencyKey = Color.FromKnownColor(KnownColor.Control);
}