楼上兄台:
            VSTreeNode SubFirst = new VSTreeNode();            SubFirst.Text = String.Format("阿超", 1); 
            SubFirst.ContextMenuStrip = this.MyContextMenuStrip;
我这种是在树节点那里加载菜单,请问怎么才能在加载的时候传递参数进去呀?MyContextMenuStrip

解决方案 »

  1.   

    sender不就标明了是谁的事件么,把sender转成发生事件的菜单的类型,然后用诸如.Text来获取。
      

  2.   

    3楼的老兄你说的没错呀,
     主要的问题是我那菜单是属于ContextMenuStrip 里的一项子菜单,
    我用(xxx)Sender.Text 是取不到值的,请教下有什么好办法吗?
      

  3.   


    private void 发送消息ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                MessageBox.Show(this.contextMenuStrip1.SourceControl.Text);
            }
    高手指导的
      

  4.   

    ...想把SourceControl显示成红色,失败了
    代码如下:        private void 发送消息ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                MessageBox.Show(this.contextMenuStrip1.SourceControl.Text);
            }用.SourceControl