問題描述
我的表單上有一個應用了平面樣式并使用背景圖像的按鈕,我已經從按鈕上刪除了所有邊框,但是當我從另一個控件上按到按鈕上時,按鈕周圍會出現黑色邊框.
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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!