Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

C# adding "focus" to a checkbox windows forms

c# windows form checkbox marking focus

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 rubbadrools


    CC Newcomer

  • Member
  • PipPip
  • 15 posts

Posted 02 April 2014 - 06:15 AM



My problem may be simple but because of the words that are used for this problem it's hard to pinpoint it by searching so I thought I might try to get help here :)


My explanatory skills are also quite poor so bare with me.


When I use tab function in my forms and come to my checkbox i want to "highlight"/"focus" to the fact that I am on the checkbox (just as when u have a "yes" & "no" dialog with a button u can see a small outline on the button u have selected).


I don't know what this function is called or anything about it, so I was hoping someone here might have the strenght to teach this poor soul or point me in the right direction!


Best regards,


#2 BlackRabbit


    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 02 April 2014 - 08:53 AM

The method you are looking for is .focus(), as in myCheckBox.focus().


There's a couple things about it. Sometimes the focus is not displayed properly, still, you have the events : .Enter  and .GotFocus

You could add the .focus to those events.


Another thing to check is the color set, in properties->border (or colors, whatever), you have the colors pre-assigned to the checkbox states, maybe they are the same as normal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download