可能重複:
How to set/change/remove focus style on a Button in C#?刪除按鈕
有沒有一種方法,以消除當按鈕被按下藍色大綱按下/ /激活?
下面是截圖:
有什麼辦法來隱藏它?我正在使用C#和winforms。
可能重複:
How to set/change/remove focus style on a Button in C#?刪除按鈕
有沒有一種方法,以消除當按鈕被按下藍色大綱按下/ /激活?
下面是截圖:
有什麼辦法來隱藏它?我正在使用C#和winforms。
從重複的問題
public class NoFocusCueButton : Button
{
public NoFocusCueButton() : base()
{
InitializeComponent();
this.SetStyle(ControlStyles.Selectable, false);
}
protected override bool ShowFocusCues
{
get
{
return false;
}
}
}
創建一個新類和繼承類Button
,如
public class OnetsButton : Button
{
public OnetsButton()
{
this.SetStyle(ControlStyles.Selectable, false);
}
}
就夠了。它很簡單,但不是更多 – harveyt
同化的答案我有一個解決方案,現在,它不是很性感,但它的作品。 我剛剛在窗體中添加了一個不可見的按鈕,現在每次點擊一個按鈕,我都選擇不可見的按鈕。適用於我。
我很確定有一個.IsActive或.IsSelected屬性,你可能會設置爲false – RhysW
如果你想隱藏「焦點」風格,你可能不太擔心可訪問性的要求,因此不關心關於鍵盤兼容性。您可以改爲使用自定義繪畫和對「OnClick」事件的響應的面板或其他控件。 – Snixtor
@RhysW沒有。 –