using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class Form1 : System.Windows.Forms.Form {
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton3;
public Form1() {
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.radioButton3,
this.radioButton2,
this.radioButton1});
this.groupBox1.Location = new System.Drawing.Point(8, 16);
this.groupBox1.Size = new System.Drawing.Size(160, 120);
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Group 1";
this.radioButton3.Appearance = System.Windows.Forms.Appearance.Button;
this.radioButton3.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(255)));
this.radioButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.radioButton3.Location = new System.Drawing.Point(16, 88);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(120, 24);
this.radioButton3.TabIndex = 2;
this.radioButton3.Text = "Option3";
this.radioButton2.Appearance = System.Windows.Forms.Appearance.Button;
this.radioButton2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
this.radioButton2.Location = new System.Drawing.Point(16, 56);
this.radioButton2.Size = new System.Drawing.Size(120, 24);
this.radioButton2.Text = "Option2";
this.radioButton2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.radioButton1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(192)));
this.radioButton1.Location = new System.Drawing.Point(16, 24);
this.radioButton1.Size = new System.Drawing.Size(120, 24);
this.radioButton1.Text = "Option1";
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(184, 149);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox1});
this.Text = "Radio Button";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
[STAThread]
static void Main() {
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e) {
Image img = Image.FromFile("EYE.ICO");
radioButton1.Image = img;
radioButton1.ImageAlign = ContentAlignment.MiddleRight;
img = Image.FromFile("WRENCH.ICO");
radioButton2.Image = img;
radioButton2.ImageAlign = ContentAlignment.MiddleLeft;
}
private void radioButton1_CheckedChanged(object sender, System.EventArgs e) {
if (radioButton1.Checked)
MessageBox.Show("Checked!");
else
MessageBox.Show("Not checked!");
}
}
|