Re: Textbox context menu on a label control
- From: "Bryan Dickerson" <txprphan@xxxxxxxxxxxx>
- Date: Tue, 3 Jan 2006 11:07:17 -0600
Thanx! Option 1 was the easiest for this exercise.
"Randy Birch" <rgb_removethis@xxxxxxxx> wrote in message
news:uvy8e0HEGHA.1584@xxxxxxxxxxxxxxxxxxxxxxx
> 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
> :
> :
>
.
- References:
- Textbox context menu on a label control
- From: Bryan Dickerson
- Re: Textbox context menu on a label control
- From: Randy Birch
- Textbox context menu on a label control
- Prev by Date: Re: Identify folder location
- Next by Date: Re: Runtime Errors - best resource
- Previous by thread: Re: Textbox context menu on a label control
- Next by thread: Re: Fixed Strings
- Index(es):
Relevant Pages
|