Remove button border on tab 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:删除选项卡上的按钮边框 c# winforms
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
