彈出式選單名稱為: a 寫入: Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu a End Sub 還可以繼續編寫子選單:用MouseUp事件裡的 Button引數(1表示左鍵 2表示右鍵) 建一個選單 vbFile 子選單vbRight: (右鍵點選窗體 就會彈出 vbFile下的幾個子選單了) 寫入: Private Sub Form_Load() vbFile.Visible = False End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case Button Case 1 Print "1" Case 2 Print "2" PopupMenu vbFile End Select End Sub 以上這樣就可以了。
彈出式選單名稱為: a 寫入: Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu a End Sub 還可以繼續編寫子選單:用MouseUp事件裡的 Button引數(1表示左鍵 2表示右鍵) 建一個選單 vbFile 子選單vbRight: (右鍵點選窗體 就會彈出 vbFile下的幾個子選單了) 寫入: Private Sub Form_Load() vbFile.Visible = False End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case Button Case 1 Print "1" Case 2 Print "2" PopupMenu vbFile End Select End Sub 以上這樣就可以了。