开发者

How to set customized tabstop color for a button in vb.net

I have placed a backgrou开发者_Go百科nd image on my windows application form and when tab stops to a particular button it's color is changed and looks awkward...Can anyone tell me that how can I set some customized color for tabstop or set its value to null????


I've tried the answer from BalaR i.e. button.ShowFocusCues = falase in load event of the form but it says that it can't be used like this and it is protected


try ShowFocusCues to false

button.ShowFocusCues = false; 

to hide focus rectangle.

I didn't notice it was a protected member. You have two options

  • use reflection to set the protected member (not recommended)
  • create a derived class and set the protected member as you'd like. (the right way)

    class MyButton : Button
    {
        protected override bool ShowFocusCues
        {
            get { return false; }
        }
    }
    

You can also set TabStop to false.

button.TabStop = false;

if you don't want the button to obtain focus during tab cycle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜