请问如何让两个From窗体中的ListView共用同一个ContextMenuStrip控件?谢谢
ListView做成用户控件,2个窗口调用。
form1中修改Form1.Designer.cs,ContextMenuStrip 定义为static
public static System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
这个修改会报一些错误,把对应的this.删了。
form2中
private void Form2_Load(object sender, EventArgs e)
{
ContextMenuStrip = Form1.contextMenuStrip1;
}