Control.Focus 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
입력 포커스를 컨트롤로 설정합니다.
public:
bool Focus();
public bool Focus();
member this.Focus : unit -> bool
Public Function Focus () As Boolean
반환
예제
다음은 포커스를 받을 수 있는 경우 지정된 포커스로 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 합니다. 포커스가 있는 시각적 신호를 표시하지 않으면서 컨트롤에 입력 포커스가 있을 수 있습니다. 이 동작은 주로 아래에 나열된 선택 불가능한 컨트롤 또는 해당 컨트롤에서 파생된 모든 컨트롤에 의해 관찰됩니다.
다음이 모두 true이면 컨트롤을 선택하고 입력 포커스를 받을 수 있습니다. 값 ControlStyles 은 Selectable로 설정true되고, 다른 컨트롤에 포함되며, 모든 부모 컨트롤이 표시되고 활성화됩니다.
다음 목록의 Windows Forms 컨트롤을 선택할 수 없습니다. 이러한 컨트롤에서 파생된 컨트롤도 선택할 수 없습니다.
LinkLabel (컨트롤에 링크가 없는 경우)
메모
Focus 는 주로 사용자 지정 컨트롤 작성자를 위한 하위 수준 메서드입니다. 대신 애플리케이션 프로그래머는 자식 컨트롤에 대한 메서드나 ActiveControl 속성 또는 양식 메서드를 Activate 사용해야 Select 합니다.