Focus checkbox to look like mousehover

I'm trying to figure out how to make a checkbox look like this when you hover over it. I have a group of checkboxes without labels and I want to give focus this way. I am currently drawing a focus rectangle around them and it works great, but I would like to try this instead.

I know I can draw it myself, but I suppose it is already done, so I would rather use that if possible.

0


a source to share


1 answer


You can use either CheckBoxRenderer (if your application uses visual styles) or ControlPaint.DrawCheckBox (if you don't use visual styles).



If you want to use visual styles, but your end users may or may not have visual styles, or if they ever launch the app when connected via remote desktop (which is likely), you will need to check the VisualStyleRenderer.IsSupported static property. to determine which method to use; trying to use the VisualStyleRenderer (from which the CheckBoxRenderer is being dropped) while visual styles are not supported will throw an exception.

0


a source







All Articles