【发布时间】:2019-10-11 13:52:38
【问题描述】:
我已经知道如何在单击按钮时创建按钮。我应该在这行旁边写什么代码才能显示/隐藏表单?
Button b1 = new Button();
b1.Location = new Point (21, 0);
b1.Name = "";
b1.Size = new Size(120, 100);
b1.FlatStyle = FlatStyle.Flat;
b1.Image = TITOMS_LOGIN.Properties.Resources.icon1_1_;
b1.BackColor = Color.Transparent;
Button b2 = new Button();
b2.Location = new Point(21, 99);
b2.Name = "";
b2.Size = new Size(120, 100);
b2.FlatStyle = FlatStyle.Flat;
b2.Image = TITOMS_LOGIN.Properties.Resources.icon2_1_;
b2.BackColor = Color.Transparent;
Button b3 = new Button();
b3.Location = new Point(21, 198);
b3.Name = "";
b3.Size = new Size(120, 100);
b3.FlatStyle = FlatStyle.Flat;
b3.Image = TITOMS_LOGIN.Properties.Resources.icon3_1_;
b3.BackColor = Color.Transparent;
Button b4 = new Button();
b4.Location = new Point(21, 297);
b4.Name = "";
b4.Size = new Size(120, 100);
b4.FlatStyle = FlatStyle.Flat;
b4.Image = TITOMS_LOGIN.Properties.Resources.icon2_1_;
b4.BackColor = Color.Transparent;
对于每个按钮,它们显示不同的形式
例如:按钮 1 显示 Form 1 并隐藏其他
按钮2显示Form 2并隐藏其他
【问题讨论】: