gpt4 book ai didi

c# - 表单运行时不显示上下文菜单项

转载 作者:可可西里 更新时间:2023-11-01 13:29:11 24 4
gpt4 key购买 nike

我已经在 Windows 窗体应用程序上创建了上下文菜单项。但是当我运行应用程序并尝试右键单击时,创建的菜单项没有显示

enter image description here

我的代码:

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)
{

}
}
}

最佳答案

您必须在您的表单或您希望它关联的任何控件上设置 ContextMenuStrip 属性:

enter image description here

关于c# - 表单运行时不显示上下文菜单项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37487205/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com