删除选项卡上的按钮边框 c# winforms

Remove button border on tab c# winforms(删除选项卡上的按钮边框 c# winforms)
本文介绍了删除选项卡上的按钮边框 c# winforms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上有一个应用了平面样式并使用背景图像的按钮,我已经从按钮上删除了所有边框,但是当我从另一个控件上按到按钮上时,按钮周围会出现黑色边框.

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 设置为 0FlatAppearance 部分.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)