Control.CanFocus 속성

정의

컨트롤이 포커스를 받을 수 있는지를 나타내는 값을 가져옵니다.

public:
 property bool CanFocus { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool CanFocus { get; }
[<System.ComponentModel.Browsable(false)>]
member this.CanFocus : bool
Public ReadOnly Property CanFocus As Boolean

속성 값

Boolean

컨트롤이 포커스를 받을 수 있으면 true이고, 그렇지 않으면 false입니다.

특성

예제

다음은 포커스를 받을 수 있는 경우 지정된 Control포커스로 포커스를 설정하는 코드 예제입니다.

public:
   void ControlSetFocus( Control^ control )
   {
      
      // Set focus to the control, if it can receive focus.
      if ( control->CanFocus )
      {
         control->Focus();
      }
   }
public void ControlSetFocus(Control control)
{
   // Set focus to the control, if it can receive focus.
   if(control.CanFocus)
   {
      control.Focus();
   }
}
Public Sub ControlSetFocus(control As Control)
   ' Set focus to the control, if it can receive focus.
   If control.CanFocus Then
      control.Focus()
   End If
End Sub

설명

컨트롤이 입력 포커스를 받으려면 컨트롤에 할당된 핸들이 있어야 하며 컨트롤과 Visible Enabled 모든 부모 컨트롤 모두에 대해 컨트롤과 속성을 모두 설정 true 해야 하며 컨트롤이 폼이거나 컨트롤의 가장 바깥쪽 부모가 폼이어야 합니다.

적용 대상

추가 정보