新聞中心
C# RadioButton是大家經(jīng)常用的一個(gè)控件,其屬性之多,但是我們只需掌握其中幾個(gè)就可以了,下面將做一下簡(jiǎn)單的介紹。

成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比五寨網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式五寨網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋五寨地區(qū)。費(fèi)用合理售后完善,10年實(shí)體公司更值得信賴。
C# RadioButton單選按鈕一般用作一個(gè)組。
1.C# RadioButton只允許用戶從幾個(gè)選項(xiàng)中選擇一個(gè),同一個(gè)容器中一次只能選擇一個(gè)按鈕;
2.C# RadioButton的Appearance屬性:根據(jù)的以下兩種取值控制外觀:
Normal:圓圈+標(biāo)簽,選中后會(huì)填充圓圈;
Button:按鈕,類似于開(kāi)關(guān),選中后按下,未選中時(shí)凸起;
3.C# RadioButton的Checked屬性:
true:選中;
false: 未選中;
4.C# RadioButton的CheckedAlign屬性:確定圓圈與標(biāo)簽文本的相對(duì)位置。
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace TestRadioButton
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string checkedRBName = "";
- //取得選中單選按鈕的名稱
- if (radioButton1.Checked)
- {
- checkedRBName = radioButton1.Name;
- }
- else if (radioButton2.Checked)
- {
- checkedRBName = radioButton2.Name;
- }
- else
- {
- checkedRBName = radioButton3.Name;
- }
- MessageBox.Show(checkedRBName + " was checked.");
- }
- }
- }
以上就是對(duì)C# RadioButton的簡(jiǎn)單介紹。
【編輯推薦】
- 探尋C# Button雙擊事件
- 實(shí)現(xiàn)方法 C# button快捷鍵
- 如何實(shí)現(xiàn)C# button定義熱鍵
- 深度剖析 C# get post實(shí)現(xiàn)方法
- C# get post的原理與用法介紹
當(dāng)前標(biāo)題:深度看點(diǎn)C#RadioButton實(shí)現(xiàn)方法
文章分享:http://www.dlmjj.cn/article/dhgihpc.html


咨詢
建站咨詢
