Using context menu, i want to be able to right click and add a label and name the label what ever i want and be able to move it where i want. is this posible? if so please explain. thanks in advance!
You can add items to the contextmenustrip programatically.
[highlight="VB.Net"]ContextMenuStrip.Items.Add("Bla bla bla")[/highlight]
Now use the appropriate event and insert an appropriate object rather than just "Bla bla bla" as string. It has further options - use intellisense.
Originally Posted by Blubb1337
You can add items to the contextmenustrip programatically.
[highlight="VB.Net"]ContextMenuStrip.Items.Add("Bla bla bla")[/highlight]
Now use the appropriate event and insert an appropriate object rather than just "Bla bla bla" as string. It has further options - use intellisense.
I think he wants a function that when he clicks in a contextmenustrpit's button a new label will appear and he should be able to rename it...
[highlight="VB.Net"] Dim lbl As New Label With {.Text = "Blaaa", .Location = New Point(5, 5)}
Me.Controls.Add(lbl)[/highlight]
On Right Click event:
[highlight=VB.Net]Dim txt = InputBox("Label text:", "Add a label")
Dim newLbl As New Label With {.Text=txt, .Location = New Point(MousePosition.X,MousePosition.Y)}
Me.Controls.Add(newLbl)
[/highlight]
thanks so much guys
Originally Posted by Lyoto Machida
On Right Click event:
[highlight=VB.Net]Dim txt = InputBox("Label text:", "Add a label")
Dim newLbl As New Label With {.Text=txt, .Location = New Point(MousePosition.X,MousePosition.Y)}
Me.Controls.Add(newLbl)
[/highlight]
seems to not display the label for some reason....
Originally Posted by asdf12345678
thanks so much guys
seems to not display the label for some reason....
CHange the MousePosition.X and etc..
To a location inside the form
Originally Posted by Lyoto Machida
CHange the MousePosition.X and etc..
To a location inside the form
i cant have it to where it can be placed where i right clicked?