☆MouseDownの処理で・・・。(2)
[Windowsフォームアプリケーション]
前回、MouseDownの処理で、左ボタンが押されたというチェックをしましたが、今回は、どの修飾子キー (Shift、Ctrl、および Alt) と一緒に押されているかをチェックします。
if (System.Windows.Forms.Control.ModifierKeys = (Keys.Shift or Keys.Control or Keys.Alt)) and (e.Button = System.Windows.Forms.MouseButtons.Left) then MessageBox.Show('Hello World!');このコードは、SHIFTキーとCTRLキーとALTキーを押しながら、左クリックした場合にメッセージを表示します。
SHIFTキーのみをチェックするのであれば、
(System.Windows.Forms.Control.ModifierKeys = Keys.Shift)
とします。
| 固定リンク