问题描述
我的表单上有一个应用了平面样式并使用背景图像的按钮,我已经从按钮上删除了所有边框,但是当我从另一个控件上按到按钮上时,按钮周围会出现黑色边框.
I have a button on my form that has flat style applied and uses a background image, I have removed all borders from the button, but when I tab onto the button from another control a black border appears around the button.
这可以在下图中看到.左侧是带有黑色边框的按钮,右侧是一个不同的按钮,但显示了取消按钮的外观.
This can be seen in the image below. On the left is the button with black border on the right is a different button but shows how the cancel button should look.
推荐答案
我没有得到这个边框,如果我在 中将
部分.BoderSize
设置为 0
FlatAppearance
I do not get this border, if I set the BoderSize
to 0
in the FlatAppearance
section.
进一步调查表明,只有当按钮是默认按钮时才会出现此边框.您可以创建自己的按钮,它永远不会像这样显示此边框
Further investigation shows that this border appears only when the button is the default button. You can create your own button, which does never show this border like this
public class NoNotifyButton: System.Windows.Forms.Button
{
public override void NotifyDefault(bool value)
{
}
}
注意:NotifyDefault
故意留空.
这篇关于删除选项卡上的按钮边框 c# winforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!