简体   繁体   English

消除按钮边框和背景图片之间的间隙

[英]Remove gap between button border and background image

I want to implement some navigation buttons (no text, only image, like flat button). 我想实现一些导航按钮(没有文本,只有图像,如平面按钮)。

I add default button with BackgroundImage property. 我添加带有BackgroundImage属性的默认按钮。 And it has a small gap between border and image. 而且边框和图像之间的距离很小。

How can I remove that gap? 我该如何消除这一差距?

As far i got your concern. 到目前为止,我已经引起您的关注。 You need to set two properties of Button. 您需要设置Button的两个属性。

  1. button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  2. button1.FlatAppearance.BorderSize = 0;

将border属性设置为None将使按钮完全平坦,并且将仅显示平坦图像

将FlatStyle设置为Flat

button1.FlatStyle = FlatStyle.Flat;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM