简体   繁体   English

窗体运行时,不显示上下文菜单项

[英]Context Menu Item is not showing when form is running

I have created context menu item on windows forms application. 我在Windows窗体应用程序上创建了上下文菜单项。 But when i run the application and when i try to right click, created menu item is not showing up 但是当我运行应用程序时,当我尝试右键单击时,创建的菜单项没有显示出来

在此输入图像描述

My Code: 我的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

You have to set the ContextMenuStrip property on your form or whatever control you want it to be associated with: 您必须在表单上设置ContextMenuStrip属性或您希望它与之关联的任何控件:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM