Re: Textbox context menu on a label control
- From: "Randy Birch" <rgb_removethis@xxxxxxxx>
- Date: Tue, 3 Jan 2006 10:48:09 -0500
Since VB labels don't have an hwnd, a context menu (if available) couldn't
access the text.
You have two alternatives:
1) use a text box directly, set to borderless, locked and with the
backcolour the same colour as the form? It will look like a label but the
user will be able to select/copy the text.
2) create / implement your own context menu. Design a hidden menu on the
form (mnuWhatever in this demo with one item - "Copy Text", menu name
mnuEdit, Index=0) and add code:
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, x As
Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mnuWhatever
End If
End Sub
Private Sub mnuEdit_Click(Index As Integer)
Select Case Index
Case 0 'copy
Clipboard.Clear
Clipboard.SetText Label1.Caption
'any other menu Case options here
Case Else
End Select
End Sub
--
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
Please reply to the newsgroups so all can participate.
"Bryan Dickerson" <txprphan@xxxxxxxxxxxx> wrote in message
news:%23cIRsbHEGHA.3868@xxxxxxxxxxxxxxxxxxxxxxx
: I've Google-grouped for this and I found what looks to be an answer, but
it
: was in Spanish which is not my native tongue or my forte'...
:
: Can someone point me in the right direction to find out how to add the
: textbox context menu items to the label control. What I'm really looking
: for is the "Copy" item.
:
: TIA!
:
: --
: TFWBWY...A
:
:
.
- Follow-Ups:
- Re: Textbox context menu on a label control
- From: Bryan Dickerson
- Re: Textbox context menu on a label control
- References:
- Textbox context menu on a label control
- From: Bryan Dickerson
- Textbox context menu on a label control
- Prev by Date: Re: Textbox context menu on a label control
- Next by Date: Re: Fixed Strings
- Previous by thread: Re: Textbox context menu on a label control
- Next by thread: Re: Textbox context menu on a label control
- Index(es):
Relevant Pages
|