当前位置: 首页>>代码示例>>C#>>正文


C# Forms.RadioButton类代码示例

本文整理汇总了C#中System.Windows.Forms.RadioButton的典型用法代码示例。如果您正苦于以下问题:C# RadioButton类的具体用法?C# RadioButton怎么用?C# RadioButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RadioButton类属于System.Windows.Forms命名空间,在下文中一共展示了RadioButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckableGroupBox

        public CheckableGroupBox()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            _checkBox = new CheckBox();
            _checkBox.Name = "checkBox";
            _checkBox.TabIndex = 1;
            _checkBox.Text = string.Empty;
            _checkBox.Checked = false;
            _checkBox.AutoCheck = true;
            _checkBox.Location = new Point(8, 0);
            _checkBox.Size = new Size(16, 16);
            _checkBox.CheckedChanged += new EventHandler(_checkBox_CheckedChanged);
            _checkBox.Click += new EventHandler(_checkBox_Click);

            _radioButton = new RadioButton();
            _radioButton.Name = "radioButton";
            _radioButton.TabIndex = 1;
            _radioButton.Text = string.Empty;
            _radioButton.Checked = false;
            _radioButton.AutoCheck = false;
            _radioButton.Location = new Point(8, 0);
            _radioButton.Size = new Size(16, 16);
            _radioButton.CheckedChanged +=new EventHandler(_radioButton_CheckedChanged);
            _radioButton.Click += new EventHandler(_radioButton_Click);

            this.Controls.Add(_checkBox);
            this.Controls.Add(_radioButton);
        }
开发者ID:pocorall,项目名称:scm-notifier,代码行数:30,代码来源:CheckableGroupBox.cs

示例2: OptionsBox

        private OptionsBox( string choicesDescription, Option[] options )
        {
            InitializeComponent();

            Text = Application.ProductName;

            int descriptionHeight = _description.Height;

            _description.Text = choicesDescription;
            _pictureBox.Image = SystemIcons.Question.ToBitmap();

            Point pt = new Point( _description.Left + 2, _description.Bottom + 20 );
            int diff = _description.Height - descriptionHeight + _okButton.Height;
            int tabIndex = 1;

            foreach( Option option in options )
            {
                RadioButton rb = new RadioButton();

                rb.AutoSize = true;
                rb.Location = pt;
                rb.Name = "radioButton" + tabIndex.ToString();
                rb.Tag = option;
                rb.TabIndex = tabIndex++;
                rb.TabStop = true;
                rb.Text = option.Description;
                rb.UseVisualStyleBackColor = true;
                Controls.Add( rb );
                rb.Visible = true;
                pt.Y += rb.Size.Height + 2;
                diff += rb.Size.Height + 2;
            }

            Size = new Size( Size.Width, Size.Height + diff );
        }
开发者ID:CecleCW,项目名称:ProductMan,代码行数:35,代码来源:OptionsBox.cs

示例3: osd_screen

		public osd_screen (int num, OSD aosd)
		{
			number=num;
			osd=aosd;
			
			num+=1;
			
			this.tabPage = new System.Windows.Forms.TabPage();		
			this.panelItems=new Panel[64];
			this.panelItems_default = new Panel[64];
			this.LIST_items=new System.Windows.Forms.TreeView();
			this.rbtSortCategory = new System.Windows.Forms.RadioButton();
            this.rbtSortAlphabetic = new System.Windows.Forms.RadioButton();
			this.groupBox = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.NUM_Y = new System.Windows.Forms.NumericUpDown();
            this.NUM_X = new System.Windows.Forms.NumericUpDown();
			this.pictureBox = new System.Windows.Forms.PictureBox();
			this.chkSign = new System.Windows.Forms.CheckBox();
			
			this.tabPage.SuspendLayout();
			this.groupBox.SuspendLayout();
			this.pictureBox.SuspendLayout();
		}
开发者ID:svpcom,项目名称:minimosd-extra,代码行数:25,代码来源:osd_screen.cs

示例4: CheckedTest

		public void CheckedTest ()
		{
			RadioButton rb = new RadioButton ();

			Assert.AreEqual (false, rb.TabStop, "#A1");
			Assert.AreEqual (false, rb.Checked, "#A2");

			rb.Checked = true;

			Assert.AreEqual (true, rb.TabStop, "#B1");
			Assert.AreEqual (true, rb.Checked, "#B2");

			rb.Checked = false;

			Assert.AreEqual (false, rb.TabStop, "#C1");
			Assert.AreEqual (false, rb.Checked, "#C2");

			// RadioButton is NOT checked, but since it is the only
			// RadioButton instance in Form, when it gets selected (Form.Show)
			// it should acquire the focus
			Form f = new Form ();
			f.Controls.Add (rb);
			rb.CheckedChanged += new EventHandler (rb_checked_changed);
			event_received = false;

			f.ActiveControl = rb;

			Assert.AreEqual (true, event_received, "#D1");
			Assert.AreEqual (true, rb.Checked, "#D2");
			Assert.AreEqual (true, rb.TabStop, "#D3");

			f.Dispose ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:33,代码来源:RadioButtonTest.cs

示例5: CreerDesControles

        /// <summary>
        /// Cette méthode crée des controles de type chckbox ou radio button dans un controle de type panel.
        /// Elle va chercher les données dans la base de données et crée autant de controles (les uns au dessous des autres
        /// qu'il y a de lignes renvoyées par la base de données.
        /// </summary>
        /// <param name="UneForme">Le formulaire concerné</param> 
        /// <param name="UneConnexion">L'objet connexion à utiliser pour la connexion à la BD</param> 
        /// <param name="pUneTable">Le nom de la source de données qui va fournir les données. Il s'agit en fait d'une vue de type
        /// VXXXXOn ou XXXX représente le nom de la tabl à partir de laquelle la vue est créée. n représente un numéro de séquence</param>  
        /// <param name="pPrefixe">les noms des controles sont standard : NomControle_XX
        ///                                         ou XX estl'id de l'enregistrement récupéré dans la vue qui
        ///                                         sert de source de données</param>
        /// <param name="UnPanel">panel ou groupbox dans lequel on va créer les controles</param>
        /// <param name="unTypeControle">type de controle à créer : checkbox ou radiobutton</param>
        /// <param name="callback"> Le pointeur de fonction. En fait le pointeur sur la fonction qui réagira à l'événement déclencheur </param>
        public static void CreerDesControles(Form UneForme, Bdd UneConnexion, String pUneTable, String pPrefixe, ScrollableControl UnPanel, String unTypeControle, Action<object, EventArgs> callback)
        {
            DataTable UneTable = UneConnexion.ObtenirDonnesOracle(pUneTable);
            // on va récupérer les statuts dans un datatable puis on va parcourir les lignes(rows) de ce datatable pour
            // construire dynamiquement les boutons radio pour le statut de l'intervenant dans son atelier

            Int16 i = 0;
            foreach (DataRow UneLigne in UneTable.Rows)
            {
                //object UnControle = Activator.CreateInstance(object unobjet, unTypeControle);
                //UnControle=Convert.ChangeType(UnControle, TypeC);

                if (unTypeControle == "CheckBox")
                {
                    CheckBox UnControle = new CheckBox();
                    AffecterControle(UneForme, UnPanel, UnControle, pPrefixe, UneLigne, i++, callback);

                }
                else if (unTypeControle == "RadioButton")
                {
                    RadioButton UnControle = new RadioButton();
                    AffecterControle(UneForme, UnPanel, UnControle, pPrefixe, UneLigne, i++, callback);
                    UnControle.CheckedChanged += new System.EventHandler(callback);
                }
                i++;
            }
            UnPanel.Height = 20 * i + 5;
        }
开发者ID:G-Youssef,项目名称:MaisonDesLigues,代码行数:43,代码来源:Utilitaire.cs

示例6: PlatformChooser_Load

		private void PlatformChooser_Load(object sender, EventArgs e)
		{
			if (RomGame.RomData.Length > 10 * 1024 * 1024) // If 10mb, show in megabytes
			{
				RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024 / 1024)) + "mb";
			}
			else
			{
				RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024)) + "kb";
			}

			ExtensionLabel.Text = RomGame.Extension.ToLower();

			int count = 0;
			int spacing = 25;
			foreach (var platform in GlobalWin.MainForm.SupportedPlatforms)
			{
				var radio = new RadioButton
				{
					Text = platform.Value,
					Location = new Point(15, 15 + (count * spacing)),
					Size = new Size(200, 23)
				};

				PlatformsGroupBox.Controls.Add(radio);
				count++;
			}

			PlatformsGroupBox.Controls
				.OfType<RadioButton>()
				.First()
				.Select();
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:33,代码来源:PlatformChooser.cs

示例7: InitializeRadioButtons

        // Radiobuttons
        public void InitializeRadioButtons()
        {
            this.groupBox11 = new System.Windows.Forms.GroupBox();
            this.radioButton21 = new System.Windows.Forms.RadioButton();
            this.radioButton11 = new System.Windows.Forms.RadioButton();
            // adding members into the groupbox

            this.groupBox11.Controls.Add(this.radioButton11);
            this.groupBox11.Controls.Add(this.radioButton21);
            this.groupBox11.Location = new System.Drawing.Point(1000, 200);
            this.groupBox11.Size = new System.Drawing.Size(200, 100);
            this.groupBox11.Text = "Radio Buttons";

            this.radioButton21.Location = new System.Drawing.Point(1000, 250);
            this.radioButton21.Size = new System.Drawing.Size(67, 17);
            this.radioButton21.Text = "Choice 2";

            this.radioButton11.Location = new System.Drawing.Point(1000, 350);
            this.radioButton11.Name = "radioButton1";
            this.radioButton11.Size = new System.Drawing.Size(67, 17);
            this.radioButton11.Text = "Choice 1";

            this.ClientSize = new System.Drawing.Size(1000, 266);
            this.Controls.Add(this.groupBox11);
        }
开发者ID:777ondro,项目名称:sw-en,代码行数:26,代码来源:Form7.cs

示例8: HienThi

 //QuyDinhData m_QuyDinhData = new QuyDinhData();
 public void HienThi(TextBox txtTenCongTy,
     TextBox txtDiaChi,
     TextBox txtDienThoai,
     Label lblTaiKhoanCo,
     NumericUpDown nudLichSaoLuu,
     TextBox txtViTriSaoLuu,
     Label lblThoiDiemSaoLuu,
     RadioButton rdbBat,
     RadioButton rdbTat)
 {
     DataTable dT = QuyDinh.LayDsQuyDinh();
     if (dT.Rows.Count == 0) return;
     int timKiemTuDong = Convert.ToInt32(dT.Rows[0]["TimKiemTuDong"]);
     if (timKiemTuDong==1)
         rdbBat.Checked = true;
     else
         rdbTat.Checked = true;
     txtTenCongTy.Text = dT.Rows[0]["TenCongTy"].ToString();
     txtDiaChi.Text = dT.Rows[0]["DiaChi"].ToString();
     txtDienThoai.Text = dT.Rows[0]["DienThoai"].ToString();
     lblTaiKhoanCo.Text = dT.Rows[0]["TaiKhoanCo"].ToString();
     nudLichSaoLuu.Value = Convert.ToInt32(dT.Rows[0]["LichSaoLuu"]);
     txtViTriSaoLuu.Text = dT.Rows[0]["ViTriSaoLuu"].ToString();
     lblThoiDiemSaoLuu.Text = dT.Rows[0]["ThoiDiemSaoLuuTiepTheo"].ToString();
 }
开发者ID:hieu292,项目名称:ngocminh,代码行数:26,代码来源:QuyDinhCtrl.cs

示例9: insertRadioButtons

 private void insertRadioButtons()
 {
     addControl((y11 = new RadioButton()), 1, 1, AnchorStyles.None,1, "Year 11");
     addControl((y12 = new RadioButton()), 2, 1, AnchorStyles.None,1, "Year 12");
     y11.Click += setSelected;
     y12.Click += setSelected;
 }
开发者ID:kostacoffee,项目名称:ExamAttend,代码行数:7,代码来源:ExamSetupUI.cs

示例10: GetPhai

 public static int GetPhai(RadioButton rdnam,RadioButton rdnu)
 {
     if (rdnam.Checked == true)
         return 1;
     else
         return 0;
 }
开发者ID:vulonggiao0207,项目名称:OLISA,代码行数:7,代码来源:LaygiatriPhai.cs

示例11: backgroundWorkerLoadThumbnail_ProgressChanged

        private void backgroundWorkerLoadThumbnail_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            // Load thumbnails & associated labels into panel
            Image thumbnail = (Image)e.UserState;
            RadioButton rb = new RadioButton();
            rb.Width = thumbnail.Width;
            rb.Appearance = Appearance.Button;
            rb.FlatStyle = FlatStyle.Flat;
            rb.FlatAppearance.BorderColor = Color.Gray;
            rb.BackgroundImage = thumbnail;
            rb.ImageAlign = ContentAlignment.MiddleCenter;
            int horizontalMargin = (this.flowLayoutPanelThumbnail.Width - rb.Width) / 2;
            rb.Margin = new Padding(horizontalMargin, 0, horizontalMargin, 2);
            rb.Height = thumbnail.Height;
            rb.ImageIndex = e.ProgressPercentage;
            rb.Click += new System.EventHandler(this.radioButton_Click);
            group.Controls.Add(rb);
            this.flowLayoutPanelThumbnail.Controls.Add(rb);

            Label label = new Label();
            label.Text = (rb.ImageIndex + 1).ToString();
            label.Width = 20;
            horizontalMargin = (this.flowLayoutPanelThumbnail.Width - label.Width) / 2;
            label.Margin = new Padding(horizontalMargin, 0, horizontalMargin, 0);
            this.flowLayoutPanelThumbnail.Controls.Add(label);
        }
开发者ID:rimas-kudelis,项目名称:VietOCR3.NET,代码行数:26,代码来源:GUIWithThumbnail.cs

示例12: Form1

        public Form1()
        {
            InitializeComponent();

            // establish the  buttons list
            buttons = new List<Button>();

            // create a group box and hide it
            hiddenBox = new GroupBox();
            hiddenBox.Visible = false;

            // add three radio buttons to the hidden group box
            rb1 = new RadioButton();
            rb1.CheckedChanged += new EventHandler(Radio_CheckedChanged);
            hiddenBox.Controls.Add(rb1);

            rb4 = new RadioButton();
            rb4.CheckedChanged += new EventHandler(Radio_CheckedChanged);
            hiddenBox.Controls.Add(rb4);

            rb6 = new RadioButton();
            rb6.CheckedChanged += new EventHandler(Radio_CheckedChanged);
            hiddenBox.Controls.Add(rb6);

            rb9 = new RadioButton();
            rb9.CheckedChanged += new EventHandler(Radio_CheckedChanged);
            hiddenBox.Controls.Add(rb9);
        }
开发者ID:phealeyh,项目名称:31927-Csharp-labs,代码行数:28,代码来源:Form1.cs

示例13: SetEnumType

        public void SetEnumType(Type enumType)
        {
            this.AutoSize = true;
            this.enumType = enumType;

            this.SuspendLayout();
            Point position = startingPoint;
            string[] names = Enum.GetNames(enumType);

            int maxWidth = 0;
            buttons = new RadioButton[names.Length];
            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = new RadioButton();
                buttons[i].AutoSize = true;
                buttons[i].Location = position;
                buttons[i].Name = names[i];
                buttons[i].Text = names[i];
                buttons[i].UseVisualStyleBackColor = true;
                maxWidth = Math.Max(maxWidth, buttons[i].Width);
                position.Y += buttons[i].Height;
                this.Controls.Add(buttons[i]);
            }

            buttons[0].Checked = true;
            this.ResumeLayout();
            this.AutoSize = false;
        }
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor-old,代码行数:28,代码来源:EnumChooser.cs

示例14: FormOpenFontDialog

        public FormOpenFontDialog()
        {
            InitializeComponent();

            string[] fontSizeList = FormFontViewer.getFontSizeList();
            string prevFontSize = null;
            Size radioSize = new Size(120, 30);
            int radioOriX = 25;
            Point radioLocation = new Point(radioOriX, 30);
            foreach (string fontSize in fontSizeList)
            {
                if (prevFontSize == null)
                {
                    prevFontSize = fontSize.Substring(0, 2);
                }
                else if (fontSize.Substring(0, 2) != prevFontSize)
                {
                    radioLocation.Y += radioSize.Height;
                    radioLocation.X = radioOriX;
                    prevFontSize = fontSize.Substring(0, 2);
                }

                RadioButton radio = new RadioButton();
                radio.Text = fontSize;
                radio.Location = radioLocation;
                radio.CheckedChanged += new System.EventHandler(this.radio_CheckedChanged);
                this.groupBox1.Controls.Add(radio);

                radioLocation.X += radioSize.Width;
            }
        }
开发者ID:pedoc,项目名称:mos-font-tool,代码行数:31,代码来源:FormOpenFontDialog.cs

示例15: btnKaydet_Click

        private void btnKaydet_Click(object sender, EventArgs e)
        {
            int soruID = 0;
            int cevapPanel = 0;

            for (int i = 0; i < panel1.Controls.Count; i++)
            {
                if (panel1.Controls[i] is Label)
                {
                    for (int l = 0; l < pnl[cevapPanel].Controls.Count; l++)
                    {
                        if (pnl[cevapPanel].Controls[l] is RadioButton)
                        {
                            cevaplar = (RadioButton)pnl[cevapPanel].Controls[l];
                        }
                        if (cevaplar.Checked == true)
                        {
                            veritabani.BaglantiKoptuysaAc();
                            veritabani.kmt.Connection = veritabani.baglanti;
                            veritabani.kmt.CommandText = "INSERT INTO AnketCevaplar(SoruID,Cevap) VALUES (" + soruIDler[soruID] + ",'" + cevaplar.Text + "')";
                            veritabani.kmt.ExecuteNonQuery();
                            veritabani.baglanti.Close();

                        }
                    }
                    cevapPanel++;
                    soruID++;
                }
            }
            //this.Refresh();
            this.Close();
        }
开发者ID:Tanjuuralkaya,项目名称:Kullanici-Etkilesimli-Soru-Cevap-Anket-Olayi,代码行数:32,代码来源:Form4.cs


注:本文中的System.Windows.Forms.RadioButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。