Click here to Skip to main content
15,891,908 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Thanks For your reply......But my Situation is as below please Check it and give me a nice solution

I want to create a custom control in vb.net, which behaves like vb6 popupmenu & it acts like form show dialog . Popup menu filled dynamically & my O/P depends only upon click event result of popupmenu.

By using context menustrip problem is click event of context menustrip is raised after all events of form which calls context menustrip . Hence I cant continue rest part of the program in Mainform using context menustrip itemclicked result.

1.My Main Form MouseUp is Called

2.Inside MouseUp Context Menu Is shown

3.After Show of Context Menu Strip the next line of Main Form MouseUp Continues result obtained from ContextMenuStrip_ItemClicked

4. ContextMenuStrip_ItemClicked have Somany other functions and codes which cannot be replaced outside of it


Private Sub ChangeLayer(ByRef X As Double, ByRef Y As Double, ByRef D As String, ByRef T As Integer)''*****Change Layer Called in MouseUp Event of MainForm
Dim A As String
Dim objDrawingPoint As New Drawing.Point
Dim cms As New ContextMenuStrip
DeleteFlag = False
'A = M_PlaceLayer.Text
A = PlaceOn.Text
If T Then
M_SelLayC(0).Enabled = False : M_SelLayC(1).Enabled = False
M_SelLayS(16).Enabled = False : M_SelLayS(17).Enabled = False
CompLayer(0).Enabled = False : CompLayer(1).Enabled = False
SolderLayer(16).Enabled = False : SolderLayer(17).Enabled = False
End If
'' M_PlaceLayer.Text = StrAnsi(D)
PlaceOn.Text = StrAnsi(D)
m_LayerFlag = False
objDrawingPoint = ViewPicture.PointToClient(Cursor.Position)
With objDrawingPoint

cm_FO.Show(ViewPicture, New Point(.X, .Y))'''**Context MenuStrip Show()


End With

'''''Depends on Result of ItemClicked of cm_FO contextmenustrip below code works

'******************************************************

'Code Below Works with result of Context MenuStrip ItemClicked

'******************************************************

' M_PlaceLayer.Text = StrAnsi(A)
PlaceOn.Text = StrAnsi(A)
If T Then
M_SelLayC(0).Enabled = True : M_SelLayC(1).Enabled = True
M_SelLayS(16).Enabled = True : M_SelLayS(17).Enabled = True
CompLayer(0).Enabled = True : CompLayer(1).Enabled = True
SolderLayer(16).Enabled = True : SolderLayer(17).Enabled = True
End If
'****************************************************
End Sub
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900