views:

66

answers:

1

I have an application in .NET 2.0 on the compact framework. When I instantiate my custom form the current form that I have visible seems to lose focus. My new form isn't visible (I haven't called ShowDialog()) on it, but my current form loses focus simply by calling the constructor on my new form. Any ideas on how to work around this? This question seemed similar but there is no ShowWithoutActivation property on the compact framework.

A: 

Maybe using WinApi specific code will help:

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.Style |= WindowStyle.WS_POPUP;
        cp.ExStyle |= ExStyle.WS_EX_TOPMOST | ExStyle.WS_EX_NOACTIVATE;
        return cp;
     }
}
arbiter
That looks like it would be pretty useful, but the `CreateParams` property doesn't exist in the compact framework.
Dennis