FT leopard brother, you give the "left mouse button, pop up the contextMenu" program-Windows development-. NET tutorial-micro

Source: Internet
Author: User

Because there is no IDE environment, the program should be as simple as possible.
Don't talk about it. Check the program.
Using System;
Using System. Windows. Forms;
Using System. Drawing;
Class useonpaint: Form
{
Public useonpaint ()
{;}

Static void Main ()
{
Application. Run (new useonpaint ());
}

Protected override void OnMouseUp (MouseEventArgs e)
{
If (e. Button = MouseButtons. Left) test (e );

}
Private void test (MouseEventArgs e)
{
ContextMenu m = new ContextMenu ();
This. ContextMenu = m;
// Create MenuItem objects.
MenuItem menuItem1 = new MenuItem ();
MenuItem menuItem2 = new MenuItem ();

// Set the Text property.
MenuItem1.Text = "New ";
MenuItem2.Text = "Open ";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.