Control.Focus 메서드

정의

컨트롤에 대한 입력 포커스를 설정합니다.

public:
 bool Focus();
public bool Focus ();
member this.Focus : unit -> bool
Public Function Focus () 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

설명

이 메서드는 Focus 컨트롤이 입력 포커스를 성공적으로 수신했는지를 반환 true 합니다. 포커스가 있다는 시각적 신호를 표시하지 않으면서 컨트롤에 입력 포커스가 있을 수 있습니다. 이 동작은 주로 아래에 나열된 선택 불가능한 컨트롤 또는 해당 컨트롤에서 파생된 모든 컨트롤에서 관찰됩니다.

A control can be selected and receive input focus if all the following are true: the Selectable value of ControlStyles is set to true, it is contained in another control, and all its parent controls are both visible and enabled.

다음 목록의 Windows Forms 컨트롤을 선택할 수 없습니다. 이러한 컨트롤에서 파생된 컨트롤도 선택할 수 없습니다.

참고

Focus 는 주로 사용자 지정 컨트롤 작성자를 위한 하위 수준 메서드입니다. 애플리케이션 프로그래머 대신 사용 해야 합니다 Select 메서드 또는 ActiveControl 자식 컨트롤에 대 한 속성 또는 Activate forms에 대 한 메서드.

적용 대상

추가 정보