Событие с RadioButton - C#
Формулировка задачи:
Ребята подскажите, у меня есть два RadioButton-на ("квадрат" и "окружность") и одна кнопка "Ок"
При выборе RadioButton-на "квадрат" и после нажатия на кнопку "Ок" все на форме исчезало и в центре появлялось несколько невидимых кнопок"?
Решение задачи: «Событие с RadioButton»
textual
Листинг программы
using System;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using System.Design;
using System.Text;
namespace Project { }
class program
{
public static void Main()
{
MyForm f = new MyForm();
Application.Run(f);
}
}
class MyForm : Form
{
Button b1;
RadioButton a1, a2;
public MyForm()
{
a1 = new RadioButton();
a1.Text = "square";
a1.Top = 100;
a1.Left = 60;
a1.Checked = true; // Метка зафиксированна на RadioButton-не "square"
a2 = new RadioButton();
a2.Text = "circle";
a2.Top = 100;
a2.Left = 180;
b1 = new Button();
b1.Text = "Ok";
b1.Height = 40;
b1.Width = 90;
b1.Top = 150;
b1.Left = 95;
this.Controls.Add(a1);
this.Controls.Add(a2);
this.Controls.Add(b1);
b1.Click += ButtonAction;
a1.Click += ButtonAction1;
// a2.Click += ButtonAction;
}
private void ButtonAction(object src, EventArgs ea)
{
}
private void ButtonAction1(object src, EventArgs ea)
{
}
}