How do you remove the dotted line that appears on buttons when they are selected (either via tab or by clicking them)?
This question is for winforms
- any help is appreciated.
Edit: I apologize for the duplicate question. I did search for an answer, but I did not know this issue was due to the 'focus' of the button. As I result I was not finding the appropriate answers.
Removing Dotted Lines Border Select the cells from which you want to remove the dotted border. Click the Home tab. In the Font group, click on the 'Border' drop-down. In the border options that appear, click on 'No Border'
We can remove the default behavior of hyperlinks which is to show a dotted outline around themselves when active or focused by declaring CSS outline property on active/focused links to be none.
Those dotted borders normally indicate that those objects are on the master page, and you are seeing them on a body page. Try View > Extras > Hide Frame Edges.
This happens because your Button
gains focus. It is possible to remove it but that means giving the focus to something else when your button's focus Enter event is triggered.
private void button1_Enter(object sender, EventArgs e)
{
// give focus to something else
}
The problem with that is that you lose the ability to use the keyboard in order to select the button (using tab).
Moreover, a more correct approach would be to give focus to the last control that had focus instead of passing it fixed one.
have you tried to remove the focus from the button.
just call Focus();
when the button is clicked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With