Context Menu Owner
-
Hi all at run time i add controls to form. i set controls contextmenu property to contextmenustrip1 whish has 3 sub menus. i wanna make something to control (like changing backcolor) when user click Menu1ToolStripMenuItem. i need like at below
Private Sub Menu1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menu1ToolStripMenuItem.Click sender) Menu1ToolStripMenuItem.Owner .ContextMenu .**attainedControl**.BackColor=red End Sub
How could i find "Attained Control" -
Hi all at run time i add controls to form. i set controls contextmenu property to contextmenustrip1 whish has 3 sub menus. i wanna make something to control (like changing backcolor) when user click Menu1ToolStripMenuItem. i need like at below
Private Sub Menu1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menu1ToolStripMenuItem.Click sender) Menu1ToolStripMenuItem.Owner .ContextMenu .**attainedControl**.BackColor=red End Sub
How could i find "Attained Control"Hi, the sender parameter contains the sending object, you should cast it to what you expect, here a menu item. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Hi all at run time i add controls to form. i set controls contextmenu property to contextmenustrip1 whish has 3 sub menus. i wanna make something to control (like changing backcolor) when user click Menu1ToolStripMenuItem. i need like at below
Private Sub Menu1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menu1ToolStripMenuItem.Click sender) Menu1ToolStripMenuItem.Owner .ContextMenu .**attainedControl**.BackColor=red End Sub
How could i find "Attained Control"I guess you are looking for ContextMenuStrip..::.SourceControl Property[^]
Giorgi Dalakishvili #region signature my articles #endregion
-
Hi, the sender parameter contains the sending object, you should cast it to what you expect, here a menu item. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
I guess you are looking for ContextMenuStrip..::.SourceControl Property[^]
Giorgi Dalakishvili #region signature my articles #endregion
-
Glad to help you :)
Giorgi Dalakishvili #region signature my articles #endregion