我已经知道单击按钮时如何创建按钮。我应该在这行旁边写什么代码,以便显示/隐藏表单?
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显示表格1而隐藏其他按钮
按钮2显示表格2并隐藏其他按钮
您应该处理按钮单击事件,并且在它们每个内部都必须实例化所需的表单并使用Show()方法显示它。