Search code examples
c#winformstopmost

Opening a WinForms Form with TopMost = true but not having it steal focus?


I have a form that pops up on a user's screen and has TopMost=true, but it steals the focus. How can I get it to not steal focus when it first appears?


Solution

  • Paste this code in your form:

    protected override bool ShowWithoutActivation
    {
        get { return true; }
    }