首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

winform 按扭有关问题

2012-11-07 
winform 按扭问题!我将按扭重写了,去掉了背景色,去掉了边框,加了背景图片,但按扭得到焦点时,会有一个边框

winform 按扭问题!
我将按扭重写了,去掉了背景色,去掉了边框,加了背景图片,但按扭得到焦点时,会有一个边框的样式! 很影响美观!

请问有什么方法可以去掉!

[解决办法]
能把代码发过来看看吗,不知道具体情况啊
[解决办法]
为什么不换pictureBox做呢?``````直接一个图片按钮 pictureBox天生有单击事情的
[解决办法]
是不是有个虚线框,如果是的话,试试这个

hidefocus="true"
[解决办法]
C# Winform界面编程时拖放的按钮很不美观,如果要贴一个透明的png图片,需要做一些属性设置,this代表此Button。 
  this.BackColor = System.Drawing.Color.Transparent; 
  //this.BackgroundImage = global::WindowsFormsApplication1.Properties.Resour ces.back;
  this.BackgroundImage = System.Drawing.Image.FromFile("../../image/spalish .jpg"); 
  this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 
  this.FlatAppearance.BorderSize = 0; 
  this.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; 
  this.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; 
  this.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 
  这样设置后,按钮按下去时,还是去出现黑线框,这个黑线框通过属性设置时无法去掉的,需要自定义按钮,然后重绘。 
  这个黑线框式聚焦框,有系统绘制。可以按如下方式自定义按钮后就可顺利去掉此黑线框。 
  //自定义了一个Button。点击Button时不会出现黑色边框 
  public class MyButton : Button
  { 
  public MyButton() 
  { 
  } 
  protected override bool ShowFocusCues 
  { 
  get 
  { 
  return false; 
  } 
  }
  }

热点排行