Shape.KeyDown 이벤트
도형에 포커스가 있을 때 키를 누르면 발생 합니다.
네임스페이스: Microsoft.VisualBasic.PowerPacks
어셈블리: Microsoft.VisualBasic.PowerPacks.Vs(Microsoft.VisualBasic.PowerPacks.Vs.dll)
구문
‘선언
<BrowsableAttribute(True)> _
Public Event KeyDown As KeyEventHandler
[BrowsableAttribute(true)]
public event KeyEventHandler KeyDown
[BrowsableAttribute(true)]
public:
event KeyEventHandler^ KeyDown {
void add (KeyEventHandler^ value);
void remove (KeyEventHandler^ value);
}
[<BrowsableAttribute(true)>]
member KeyDown : IEvent<KeyEventHandler,
KeyEventArgs>
JScript에서는 이벤트를 지원하지 않습니다.
설명
키 이벤트는 다음 순서대로 발생합니다.
KeyDown
폼 수준 에서만 키보드 이벤트를 처리 하 고 키보드 이벤트를 수신 하는 셰이프를 사용 하려면 설정에서 Handled 속성은 폼의 KeyPress 이벤트 처리 메서드를 true.
이벤트를 처리하는 방법에 대한 자세한 내용은 이벤트 사용을 참조하십시오.
예제
다음 예제에서는 응답 하는 방법을 보여 줍니다 있는 KeyDown 이벤트에서 이벤트 처리기 탭 도형 사이.이 예제에서는 있어야는 RectangleShape RectangleShape1, 명명 된 컨트롤은 OvalShape OvalShape1, 명명 된 컨트롤 하는 LineShape 폼에 LineShape1 이라는 컨트롤.
Private Sub Shapes_KeyDown(
ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs
) Handles RectangleShape1.KeyDown, OvalShape1.KeyDown,
LineShape1.KeyDown
' Check to see whether the TAB key was pressed.
If e.KeyCode = Keys.Tab Then
' Call the Tab procedure
Tab(sender)
End If
End Sub
Private Sub Tab(ByVal sender As Shape)
' Select the next shape.
sender.Parent.SelectNextShape(sender, True, True)
End Sub
private void Shapes_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
// Check to see whether the TAB key was pressed.
if (e.KeyCode == Keys.Tab)
// Call the Tab procedure
{
Tab((Shape) sender);
}
}
private void Tab(Shape sender)
{
// Select the next shape.
sender.Parent.SelectNextShape(sender, true, true);
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.
참고 항목
참조
Microsoft.VisualBasic.PowerPacks 네임스페이스
기타 리소스
방법: LineShape 컨트롤로 선 그리기(Visual Studio)
방법: OvalShape 및 RectangleShape 컨트롤을 사용하여 도형 그리기(Visual Studio)