变成灰的行不行呀? Option ExplicitDim selStart As Long, selLength As LongPrivate Sub Text2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then selStart = Text2.selStart selLength = Text2.selLength Text2.selLength = 0 Text2.selStart = 0 End If End SubPrivate Sub Text2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Text2.selStart = selStart Text2.selLength = selLength End If End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Text1.PopupMenu 你自己的菜单 End If End Sub
到 api 版去问比较好!
那还不如下直接从 api 下手屏蔽掉不要的选项来得直接另:不会没办法吧,很多网页上的文本都是屏蔽了"剪切"和"粘贴"功能(Enable=False),而保留了"复制"功能===============网页上可能不同的,设置了一个无边框的文本框为“只读”属性,就自动屏蔽了 "剪切"和"粘贴" ,与 vb 中不一样的。你将 vb 的 textbox 设置为 locked=true ,也有这效果!如果你的输入框不需要编辑,直接设置 locked 就可以了。
如果你的输入框不需要编辑,直接设置 locked 就可以了。解决了一半的问题,"剪切"功能是可以屏蔽了,但是"粘贴"功能还是不能屏蔽。
Option ExplicitDim selStart As Long, selLength As LongPrivate Sub Text2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
selStart = Text2.selStart
selLength = Text2.selLength
Text2.selLength = 0
Text2.selStart = 0
End If
End SubPrivate Sub Text2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Text2.selStart = selStart
Text2.selLength = selLength
End If
End Sub
If Button = 2 Then
Text1.PopupMenu 你自己的菜单
End If
End Sub