不让它有焦点。
干脆用Label代替Button,就没有焦点,不会出虚线框。

解决方案 »

  1.   

    我也遇到过 ,用个小Panel 解决的!
      

  2.   

    这个是因为你点击过后,聚焦在按钮上
    such as 
    class NewButton: Button
    {
         public char chKey;     public CalcButton(Control parent, string str, char chkey, 
                           int x, int y, int cx, int cy)
         {
              Parent   = parent;
              Text     = str;
              chKey    = chkey;
              Location = new Point(x, y);
              Size     = new Size(cx, cy);
      SetStyle(ControlStyles.Selectable, false);
         }
    }
    其实关键的是
    SetStyle(ControlStyles.Selectable, false);
      

  3.   

    那怎么调用呢?给个例子吧,thx
      

  4.   

    不是调用。
    用这个NewButton控件代替原来的Button控件
      

  5.   

    载入新的控件就是了,你没注意到上面的例子的:class NewButton: Button 这表示继承button 类你可以试试 this.button1.FlatStyle = FlatStyle.Popup; 也不错的呀或者你在click 之后转移焦点给别的控件就是了
      

  6.   

    如果一定要用Button,干脆给Button增加一个Selectable属性:
    public class MyButton: System.Windows.Forms.Button
    {
      public bool Selectable
      {
        get { return this.GetStyle(System.Windows.Forms.ControlStyles.FixedHeight); }
        set { this.SetStyle(System.Windows.Forms.ControlStyles.Selectable, value); }
      }
    }这样使用这个MyButton控件替代.net的Button。private MyButton button1;
    ...button1.Selectable=false;  //设置不让捕获焦点;
    button1.Selectable=true;   //设置可以捕获焦点,就和.net的Button完全一样。