Control.ModifierKeys 속성
눌려진 보조키(Shift, Ctrl 및 Alt)를 나타내는 값을 가져옵니다.
네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
Public Shared ReadOnly Property ModifierKeys As Keys
‘사용 방법
Dim value As Keys
value = Control.ModifierKeys
public static Keys ModifierKeys { get; }
public:
static property Keys ModifierKeys {
Keys get ();
}
/** @property */
public static Keys get_ModifierKeys ()
public static function get ModifierKeys () : Keys
속성 값
Keys 값의 비트 조합입니다. 기본값은 None입니다.
예제
다음 코드 예제에서는 Ctrl 키를 누른 채로 단추를 클릭할 때 단추를 숨깁니다. 이 예제를 실행하려면 Form에 button1
이라는 Button이 있어야 합니다.
Private Sub button1_Click(sender As Object, _
e As EventArgs) Handles button1.Click
' If the CTRL key is pressed when the
' control is clicked, hide the control.
If Control.ModifierKeys = Keys.Control Then
CType(sender, Control).Hide()
End If
End Sub
private void button1_Click(object sender, System.EventArgs e)
{
/* If the CTRL key is pressed when the
* control is clicked, hide the control. */
if(Control.ModifierKeys == Keys.Control)
{
((Control)sender).Hide();
}
}
private:
void button1_Click( Object^ sender, System::EventArgs^ /*e*/ )
{
/* If the CTRL key is pressed when the
* control is clicked, hide the control. */
if ( Control::ModifierKeys == Keys::Control )
{
(dynamic_cast<Control^>(sender))->Hide();
}
}
private void button1_Click(Object sender, System.EventArgs e)
{
/* If the CTRL key is pressed when the
control is clicked, hide the control.
*/
if (Control.get_ModifierKeys().Equals(Keys.Control)) {
((Control)sender).Hide();
}
} //button1_Click
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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에서 지원