查看完整版本: VB使用滑鼠右鍵點擊來觸發事件
頁: [1]

show7682223 發表於 2014-7-25 08:12 PM

VB使用滑鼠右鍵點擊來觸發事件

本帖最後由 show7682223 於 2014-7-25 08:13 PM 編輯

在書上看到只找到左鍵點擊觸發事件的功能

網路上也找了好久  始終無法得到解答

想要請問大大  如何將觸發事件時的左鍵  變成右鍵

也就是我想要做到  在一個程式裡

我點擊左鍵  左邊圖片消失  點擊右鍵  右邊圖片消失

目前卡在右鍵的部份  

麻煩大大解答

<div></div>

sam30525sam 發表於 2014-7-25 08:43 PM



1. Windows Form 中的滑鼠事件
2. C# Mouse按鍵事件問題
3. e.Button 與 MouseButtons.Left

提示跟資料就這樣,沒意外這就可以解決你的問題。

Jeepluo 發表於 2014-7-29 03:30 PM

以 PictureBox 為例這樣做就可以了,你還可以決定那個做要什麼都可以    Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
        If Windows.Forms.MouseButtons.Right = Windows.Forms.MouseButtons.Right Or Windows.Forms.MouseButtons.Left = Windows.Forms.MouseButtons.Left Then
            PictureBox1.Visible = False
        End If
    End Sub
頁: [1]