如何在WinFrom的按钮中添加快捷键,要求隐藏按钮的.不隐藏我已经知道,但是我不想看到按钮的,请各位告诉,感谢!!!!

解决方案 »

  1.   

    你可以不用定义按钮,可以直接重载form得ProcessCmdKey,在其中判断按键信息,然后进行转发。例如:
    protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
    {
    if(msg.WParam.ToInt32() == (int) Keys.Multiply )
    {
    //call your button event function here
    return true;
    }
    return base.ProcessCmdKey(ref msg, keyData);
    }
      

  2.   

    原来是在ProcessCmdKey上做文章。学习。