Thursday, September 23, 2010

.Net button that doesn't take/steal focus

This is a simple solution that I've came up with after some thinking:

public class MyButton : Button
{
public MyButton()
{
if (!DesignMode)
{
SetStyle(ControlStyles.Selectable, false);
}
}
}

Much easier than trying to handle mouse activation messages etc...

No comments:

Post a Comment