发布网友 发布时间:2024-03-04 23:42
共1个回答
热心网友 时间:2024-04-23 23:37
建一个菜单 vbFile 子菜单vbRight:(右键点击窗体 就会弹出 vbFile下的几个子菜单了)Private Sub Form_Load()vbFile.Visible = FalseEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Select Case ButtonCase 1Print "点击了左键"Case 2Print "点击了右键"PopupMenu vbFileEnd SelectEnd Sub----------------------------Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 ThenPopupMenu color, 4 Or 0End IfEnd Sub是对的。 建议改成MouseUp事件,因为你看正常的弹出菜单 都是鼠标键弹起来出现的才发现 你是想要把系统的右键弹出式菜单屏蔽吧如下代码即可(把相应代码改成你想要的)Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 ThenPopupMenu color, 0 Or 4'左键所触发的内容End IfIf Button = 2 Then'右键所触发的内容Text1.Enabled = False