日期:2014-05-17 浏览次数:20998 次
void DrawControl()
{
panel1.Controls.Clear();
int count = _mappings.Length;
//Draw and set control
int height = 0;
int x_aris = 50;
int y_aris = 50;
for (int i = 0; i < count; i++)
{
//create the radio button
RadioButton radio = new RadioButton();
radio.Name = i.ToString();
radio.Text = _mappings[i].Text;
radio.AutoSize = true;
//put radio button into the panel
panel1.Controls.Add(radio);
radio.Location = new Point(x_aris, y_aris + height);
height += radio.Height;
//Add click event to radio button
radio.Click += new EventHandler(radio_Click);
}
}