Control.ModifierKeys プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


ボタンがクリックされたときに Ctrl キーが押されている場合、次のコード例ではそのボタンが非表示になります。この例では、button1 という Button が Form 上に存在している必要があります。
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(); } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からControl.ModifierKeys プロパティを検索する場合は、下記のリンクをクリックしてください。

- Control.ModifierKeys プロパティのページへのリンク