다음을 통해 공유


RadioButton 클래스

다른 RadioButton 컨트롤과 함께 사용할 경우 사용자가 선택 그룹에서 단일 옵션을 선택할 수 있습니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class RadioButton
    Inherits ButtonBase
‘사용 방법
Dim instance As RadioButton
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class RadioButton : ButtonBase
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class RadioButton : public ButtonBase
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class RadioButton extends ButtonBase
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class RadioButton extends ButtonBase

설명

RadioButton 컨트롤에는 텍스트, Image 또는 모두를 표시할 수 있습니다.

그룹에서 옵션 단추(라디오 단추라고도 함)를 하나 선택하면 다른 단추의 선택은 자동으로 취소됩니다. 그룹은 Form과 같은 지정된 컨테이너의 모든 RadioButton 컨트롤로 구성됩니다. 하나의 폼에 여러 개의 그룹을 만들려면 각 그룹을 GroupBox 또는 Panel 컨트롤과 같은 해당 컨테이너에 배치합니다.

RadioButtonCheckBox 컨트롤의 기능은 유사합니다. 이 컨트롤에는 선택하거나 선택 취소할 수 있는 항목이 제공됩니다. 옵션 단추와는 달리 CheckBox 컨트롤은 여러 개를 동시에 선택할 수 있습니다.

Checked 속성을 사용하여 RadioButton의 상태를 가져오거나 설정할 수 있습니다. Appearance 속성을 설정하면 옵션 단추의 모양을 토글 스타일 단추나 표준 옵션 단추 모양으로 변경할 수도 있습니다.

예제

다음 코드 예제에서는 RadioButton을 만들어 초기화하고 토글 단추 모양으로 만든 다음 AutoCheck 속성을 false로 설정하여 Form에 추가합니다.

Private Sub InitializeMyRadioButton()
    ' Create and initialize a new RadioButton. 
    Dim radioButton1 As New RadioButton()
       
    ' Make the radio button control appear as a toggle button.
    radioButton1.Appearance = Appearance.Button
       
    ' Turn off the update of the display on the click of the control.
    radioButton1.AutoCheck = False
       
    ' Add the radio button to the form.
    Controls.Add(radioButton1)
End Sub
private void InitializeMyRadioButton()
{
   // Create and initialize a new RadioButton. 
   RadioButton radioButton1 = new RadioButton();
   
   // Make the radio button control appear as a toggle button.
   radioButton1.Appearance = Appearance.Button;

   // Turn off the update of the display on the click of the control.
   radioButton1.AutoCheck = false;

   // Add the radio button to the form.
   Controls.Add(radioButton1);
}
private void InitializeMyRadioButton()
{
    // Create and initialize a new RadioButton. 
    RadioButton radioButton1 = new RadioButton();

    // Make the radio button control appear as a toggle button.
    radioButton1.set_Appearance(Appearance.Button);

    // Turn off the update of the display on the click of the control.
    radioButton1.set_AutoCheck(false);
    
    // Add the radio button to the form.
    get_Controls().Add(radioButton1);
} //InitializeMyRadioButton

상속 계층 구조

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ButtonBase
          System.Windows.Forms.RadioButton

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

RadioButton 멤버
System.Windows.Forms 네임스페이스
ButtonBase 클래스
Button 클래스
CheckBox 클래스