Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to apply focus visual style for a button without actually focusing it?

Trying to get a similar effect as the Windows Run dialog. The input box is focused and taking input, and the "OK" button also gets the focused border(but not actually focused). I can’t find a way to set button’s visual style properly…

C# Winform, .net 4.5(higher version is also OK).

enter image description here.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The property you’re looking for is AcceptButton on the form it self.
Select the okButton on the form AcceptButton property to make it the default action on Enter keypress.

You also have a similar action for the CancelButton that triggers on Escape keypress.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading