Radio Group : 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 
Radio Group
Radio Group

/*
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 Peaks
{
    /// <summary>
    /// Summary description for Peaks.
    /// </summary>
    public class Peaks : 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;
        private System.Windows.Forms.RadioButton radioButton4;
        private System.Windows.Forms.RadioButton radioButton5;
        private System.Windows.Forms.RadioButton radioButton6;
        private System.Windows.Forms.RadioButton radioButton7;
        private System.Windows.Forms.RadioButton radioButton8;
        private System.Windows.Forms.RadioButton radioButton9;
        private System.Windows.Forms.RadioButton radioButton10;
        private System.Windows.Forms.RadioButton radioButton11;
        private System.Windows.Forms.RadioButton radioButton12;

        Point[] pnts = new Point(2090)new Point(5570),
                           new Point(8080)new Point(10540),  
                           new Point(13090)};

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Peaks()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.radioButton1.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton2.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton3.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton4.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton5.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton6.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton7.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton8.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton9.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton10.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton11.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);
            this.radioButton12.CheckedChanged += new System.EventHandler(RBs_CheckedChanged);

            //
            // 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.radioButton1 = new System.Windows.Forms.RadioButton();
            this.radioButton2 = new System.Windows.Forms.RadioButton();
            this.radioButton3 = new System.Windows.Forms.RadioButton();
            this.radioButton6 = new System.Windows.Forms.RadioButton();
            this.radioButton5 = new System.Windows.Forms.RadioButton();
            this.radioButton4 = new System.Windows.Forms.RadioButton();
            this.radioButton7 = new System.Windows.Forms.RadioButton();
            this.radioButton9 = new System.Windows.Forms.RadioButton();
            this.radioButton8 = new System.Windows.Forms.RadioButton();
            this.radioButton10 = new System.Windows.Forms.RadioButton();
            this.radioButton12 = new System.Windows.Forms.RadioButton();
            this.radioButton11 = new System.Windows.Forms.RadioButton();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                    this.radioButton1,
                                                                                    this.radioButton2,
                                                                                    this.radioButton3,
                                                                                    this.radioButton6,
                                                                                    this.radioButton5,
                                                                                    this.radioButton4,
                                                                                    this.radioButton7,
                                                                                    this.radioButton9,
                                                                                    this.radioButton8,
                                                                                    this.radioButton10,
                                                                                    this.radioButton12,
                                                                                    this.radioButton11});
            this.groupBox1.Location = new System.Drawing.Point(2008);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(304120);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Primitives";
            // 
            // radioButton1
            // 
            this.radioButton1.Location = new System.Drawing.Point(1624);
            this.radioButton1.Name = "radioButton1";
            this.radioButton1.Size = new System.Drawing.Size(8816);
            this.radioButton1.TabIndex = 0;
            this.radioButton1.Text = "4xLine";
            // 
            // radioButton2
            // 
            this.radioButton2.Location = new System.Drawing.Point(11224);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new System.Drawing.Size(5616);
            this.radioButton2.TabIndex = 0;
            this.radioButton2.Text = "Lines";
            // 
            // radioButton3
            // 
            this.radioButton3.Location = new System.Drawing.Point(18424);
            this.radioButton3.Name = "radioButton3";
            this.radioButton3.Size = new System.Drawing.Size(8016);
            this.radioButton3.TabIndex = 0;
            this.radioButton3.Text = "Polygon";
            // 
            // radioButton6
            // 
            this.radioButton6.Location = new System.Drawing.Point(18448);
            this.radioButton6.Name = "radioButton6";
            this.radioButton6.Size = new System.Drawing.Size(8016);
            this.radioButton6.TabIndex = 0;
            this.radioButton6.Text = "Curve 1.1";
            // 
            // radioButton5
            // 
            this.radioButton5.Location = new System.Drawing.Point(11248);
            this.radioButton5.Name = "radioButton5";
            this.radioButton5.Size = new System.Drawing.Size(8816);
            this.radioButton5.TabIndex = 0;
            this.radioButton5.Text = "Curve 0.6";
            // 
            // radioButton4
            // 
            this.radioButton4.Location = new System.Drawing.Point(1648);
            this.radioButton4.Name = "radioButton4";
            this.radioButton4.Size = new System.Drawing.Size(8816);
            this.radioButton4.TabIndex = 0;
            this.radioButton4.Text = "Curve 0";
            // 
            // radioButton7
            // 
            this.radioButton7.Location = new System.Drawing.Point(1672);
            this.radioButton7.Name = "radioButton7";
            this.radioButton7.Size = new System.Drawing.Size(8816);
            this.radioButton7.TabIndex = 0;
            this.radioButton7.Text = "2xBezier";
            // 
            // radioButton9
            // 
            this.radioButton9.Location = new System.Drawing.Point(18472);
            this.radioButton9.Name = "radioButton9";
            this.radioButton9.Size = new System.Drawing.Size(11216);
            this.radioButton9.TabIndex = 0;
            this.radioButton9.Text = "ClosedCurve 1.1";
            // 
            // radioButton8
            // 
            this.radioButton8.Location = new System.Drawing.Point(11272);
            this.radioButton8.Name = "radioButton8";
            this.radioButton8.Size = new System.Drawing.Size(8816);
            this.radioButton8.TabIndex = 0;
            this.radioButton8.Text = "Beziers";
            // 
            // radioButton10
            // 
            this.radioButton10.Location = new System.Drawing.Point(1696);
            this.radioButton10.Name = "radioButton10";
            this.radioButton10.Size = new System.Drawing.Size(8816);
            this.radioButton10.TabIndex = 0;
            this.radioButton10.Text = "2xBezier";
            // 
            // radioButton12
            // 
            this.radioButton12.Location = new System.Drawing.Point(18496);
            this.radioButton12.Name = "radioButton12";
            this.radioButton12.Size = new System.Drawing.Size(8816);
            this.radioButton12.TabIndex = 0;
            this.radioButton12.Text = "Curve";
            // 
            // radioButton11
            // 
            this.radioButton11.Location = new System.Drawing.Point(11296);
            this.radioButton11.Name = "radioButton11";
            this.radioButton11.Size = new System.Drawing.Size(8816);
            this.radioButton11.TabIndex = 0;
            this.radioButton11.Text = "Beziers";
            // 
            // Peaks
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(513);
            this.ClientSize = new System.Drawing.Size(504133);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.groupBox1});
            this.Name = "Peaks";
            this.Text = "Two Peaks";
            this.groupBox1.ResumeLayout(false);
            this.ResumeLayout(false);
        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new Peaks());
        }
        private void RBs_CheckedChanged(object sender, System.EventArgs e)
        {
            this.Refresh();
        }
        protected override void OnPaint (System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;   
            g.Clear(this.BackColor)
         
            if (this.radioButton1.CheckedEx01_4xLine(g);
            if (this.radioButton2.CheckedEx02_Lines(g);
            if (this.radioButton3.CheckedEx03_Polygon(g);
            if (this.radioButton4.CheckedEx04_Curve0(g);
            if (this.radioButton5.CheckedEx05_Curve1(g);
            if (this.radioButton6.CheckedEx06_Curve2(g);
            if (this.radioButton7.CheckedEx07_2xBezier(g);
            if (this.radioButton8.CheckedEx08_Beziers(g);
            if (this.radioButton9.CheckedEx09_ClosedCurve(g);
            if (this.radioButton10.CheckedEx10_2xBezier_2(g);
            if (this.radioButton11.CheckedEx11_Beziers_2(g);
            if (this.radioButton12.CheckedEx11_Curve_2(g);
            
            g.Dispose();
        }
        protected void Ex01_4xLine(Graphics g
        {
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawLine(pn, 20905570)
            g.DrawLine(pn, 55708080)
            g.DrawLine(pn, 8080,10540);
            g.DrawLine(pn,10540,13090);
        }

        protected void Ex02_Lines(Graphics g
        {
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawLines(pn, pnts);
        }
        protected void Ex03_Polygon(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawPolygon(pn, pnts);
        }
        protected void Ex04_Curve0(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawCurve(pn, pnts, 0.0f);
        }
        protected void Ex05_Curve1(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawCurve(pn, pnts, 0.6f);
        }
        protected void Ex06_Curve2(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawCurve(pn, pnts, 1.1f);
        }
        protected void Ex07_2xBezier(Graphics g
        {
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawBezier(pn, 2090507060708080)
            g.DrawBezier(pn, 8080,10040,11040,13090);
        }

        protected void Ex08_Beziers(Graphics g
        {
            Pen pn = new Pen(Color.Blue, 2);
            Point[] pnts = {new Point(2090)new Point(5070),
                               new Point(6070)new Point(8080),
                               new Point(10040)new Point(11040),
                               new Point(13090)}
            g.DrawBeziers(pn, pnts);
        }
        protected void Ex09_ClosedCurve(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            Point[] pnts = {new Point2090)new Point5570),
                               new Point8080)new Point(10540),  
                               new Point(13090)};
            g.DrawClosedCurve(pn, pnts, 1.1f, System.Drawing.Drawing2D.FillMode.Winding);
        }
        protected void Ex10_2xBezier_2(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            g.DrawBezier(pn, 2090507060708080)
            g.DrawBezier(pn, 8080,100,120,110,120,13090);
        }
        protected void Ex11_Beziers_2(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            int[,xy = {   { 2090}5070},
                            6070}8080},
                            {100,120}{110,120},
                            {13090}}
            int ii = xy.GetLength(0);
            Point[] pnts = new Point[ii];
            for(int i = 0; i < ii; i++)
            {               
                pnts[i].X = xy[i, 0];
                pnts[i].Y = xy[i, 1];
            }
            g.DrawBeziers(pn, pnts);
        }
        protected void Ex11_Curve_2(Graphics g
        {  
            Pen pn = new Pen(Color.Blue, 2);
            Point[] pnts = {new Point2090)new Point5570),
                               new Point8080)new Point(105,120),  
                               new Point(13090)};
            g.DrawCurve(pn, pnts, 0.0f);
        }
    }
}


           
       
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.RadioButton With ImgRadioButton With Img
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.