Scenes
The sub-option shows how to add pictures when the right mouse button in Winform program.
Note:
Blog home page:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.
achieve
New Winform program, add a photo of resources under the Resources under Properties.
Then drag a Button to the form, click on the event in Button's
// declare the right mouse button menu System.Windows.Forms.ContextMenuStrip ctxMenu = new new System.Windows.Forms.ContextMenuStrip (); // set the right sub-options ToolStripMenuItem mnuDelete = new new ToolStripMenuItem (); // set the sub-options of text mnuDelete.Text = " delete " ; // set of sub-options photo mnuDelete.Image = Properties.Resources.delete; // sub-option to the context menu ctxMenu.Items.Add (mnuDelete); // get a button Button = SENDER the Button AS the Button; // make the right and set the display position of the menu display ctxMenu.Show (Button, new new Point ( 0 , 0 ));