不让它有焦点。
干脆用Label代替Button,就没有焦点,不会出虚线框。
干脆用Label代替Button,就没有焦点,不会出虚线框。
解决方案 »
- 请教一个问题,如何对Dictionary或Idictionary中的内容进行排序,多谢
- 如何读取出DATASET中的数据
- 哪里有Programming Language Pragmatics Second Edition下载?
- 有点麻烦,socket连接问题
- 字符串验证问题,请教
- 在C#编写的Client程序中如何引用服务器上的 Web service 服务 请解答
- 关于telnet的问题?
- C#工程程序怎么做安装程序?
- 菜单、工具条中图标大小的问题
- 无论如何也安装不上vs.net,但组件更新又能成功,安装程序的错误提示如下
- 怎么使TreeNode含有一个隐含的值。最好有源代码.
- 1。做树时怎么判断当前节点是否有子节点2。怎么判断此节点是此树的绝对索引。比如:node.index是相对索引。
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);
用这个NewButton控件代替原来的Button控件
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完全一样。