开发者

C#: form.TopMost = true not working on Windows 7

I am developing a Windows Setup project using开发者_如何学Go an installer class. I am opening a Windows form before installation and it opens successfully. I want to open this form as a Topmost form, but it opens behind the Setup Wizard on Windows 7.

This form opens as a topmost form successfully on Windows XP during setup. The problem arises only on Windows 7.

I am using the following code for opening that form in my installer class:

namespace MyApp
{
    [RunInstaller(true)]
    public partial class DbInstallerClass : Installer
    {
        public DbInstallerClass()
        {
            InitializeComponent();
            Form frm = new DBInstallerForm();                                  
            frm.TopMost = true;  
            frm.ShowDialog();
        }
    }
}

Is this problem platform specific or OS specific?


It works if you put it under load:

private void MainForm_Load(object sender, EventArgs e)
{
    this.TopMost = true;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜