RadioButton With Img : RadioButton « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » RadioButtonScreenshots 
RadioButton With Img
RadioButton With Img

/*
Professional Windows GUI Programming Using C#
by Jay Glynn, Csaba Torok, Richard Conway, Wahid Choudhury, 
   Zach Greenvoss, Shripad Kulkarni, Neil Whitlow

Publisher: Peer Information
ISBN: 1861007663
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace RadioButtonWithImg
{
  /// <summary>
  /// Summary description for RadioButtonWithImg.
  /// </summary>
  public class RadioButtonWithImg : 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;
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;

    public RadioButtonWithImg()
    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

      //
      // TODO: Add any constructor code after InitializeComponent call
      //
    }

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Disposebool disposing )
    {
      ifdisposing )
      {
        if (components != null
        {
          components.Dispose();
        }
      }
      base.Disposedisposing );
    }

    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
         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();
         // 
         // groupBox1
         // 
         this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                this.radioButton3,
                                                                                this.radioButton2,
                                                                                this.radioButton1});
         this.groupBox1.Location = new System.Drawing.Point(816);
         this.groupBox1.Name = "groupBox1";
         this.groupBox1.Size = new System.Drawing.Size(160120);
         this.groupBox1.TabIndex = 1;
         this.groupBox1.TabStop = false;
         this.groupBox1.Text = "Group 1";
         // 
         // radioButton3
         // 
         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(1688);
         this.radioButton3.Name = "radioButton3";
         this.radioButton3.Size = new System.Drawing.Size(12024);
         this.radioButton3.TabIndex = 2;
         this.radioButton3.Text = "Option3";
         // 
         // radioButton2
         // 
         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(1656);
         this.radioButton2.Name = "radioButton2";
         this.radioButton2.Size = new System.Drawing.Size(12024);
         this.radioButton2.TabIndex = 1;
         this.radioButton2.Text = "Option2";
         this.radioButton2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
         // 
         // radioButton1
         // 
         this.radioButton1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255))((System.Byte)(192))((System.Byte)(192)));
         this.radioButton1.Location = new System.Drawing.Point(1624);
         this.radioButton1.Name = "radioButton1";
         this.radioButton1.Size = new System.Drawing.Size(12024);
         this.radioButton1.TabIndex = 0;
         this.radioButton1.Text = "Option1";
         this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
         // 
         // RadioButton
         // 
         this.AutoScaleBaseSize = new System.Drawing.Size(513);
         this.ClientSize = new System.Drawing.Size(184149);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                      this.groupBox1});
         this.Name = "RadioButton";
         this.Text = "Radio Button";
         this.Load += new System.EventHandler(this.RadioButtonWithImg_Load);
         this.groupBox1.ResumeLayout(false);
         this.ResumeLayout(false);

      }
    #endregion

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
      Application.Run(new RadioButtonWithImg());
    }

    private void RadioButtonWithImg_Load(object sender, System.EventArgs e)
    {
      // Select the Image for the button
      Image img = Image.FromFile("EYE.ICO");    
      // Assign the Image to the button
      radioButton1.Image = img ;
      // Align the image 
      radioButton1.ImageAlign = ContentAlignment.MiddleRight;

      // Select the Image for the button
      img = Image.FromFile("WRENCH.ICO");    
      // Assign the Image to the button
      radioButton2.Image = img ;
      // Align the image 
      radioButton2.ImageAlign = ContentAlignment.MiddleLeft;
    }

      private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
      {
         if (radioButton1.Checked)
            MessageBox.Show("Checked!");
         else
            MessageBox.Show("Not checked!");
      }
  }
}


           
       
RadioButton.zip( 30 k)
Related examples in the same category
1.Load image to RadioButtonLoad image to RadioButton
2.Radio button check changed eventRadio button check changed event
3.Get selected radio buttonGet selected radio button
4.Using RadioButtons to set message window optionsUsing RadioButtons to set message window options
5.Radio Button click eventRadio Button click event
6.RadioButton check state change eventRadioButton check state change event
7.RadioButton on a formRadioButton on a form
8.Radio GroupRadio Group
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.