Question Problem in button.

priyamtheone

Well-known member
Joined
Sep 20, 2007
Messages
96
Programming Experience
Beginner
When a button is focused by pressing Tab key, a rectangle appears on it. Even if the button's TabStop property is set to false, when the button is clicked with mouse the rectangle appears. Is it possible to stop the rectangle from appearing? Please help. Regards.
 
The default button draws the rectangle when it is focused, at least this is the rectangle I think you mean, the thin dotted rectangle line. To not display this you can create your own inherited Button class and override Focused property to always return False. Another option that require some more code is to override OnPaint and use ButtonRenderer class to draw the button like you want, ie always use False for the focused parameter of DrawButton method. This however also require you to handle the current state of the button to provide an appropriate PushButtonState value.
 
Back
Top