开发者

Instantiate form without losing focus on existing form

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 cal开发者_运维知识库led 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.


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;
     }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜