tags:

views:

35

answers:

2

hi,

I want to pop up a form in C# .net 2.0 which should be in front of the desktop (topmost) until the user clicks the close button.

How to do so?

I tried the code from here: http://dotnet-snippets.de/dns/fenster-wirklich-in-den-vordergrund-des-desktops-bringen-SID1005.aspx

But it didn't work. My system is Win7.

+3  A: 

Set the form's TopMost property to true and MinimizeBox property to false.

David Morton
so simple =)...
Kovu
+3  A: 

Code below will create MessageBox with TopMost property making it on Top until user clicks No or Yes.

       DialogResult result = DialogResult.No;
        try {
            result = MessageBox.Show(new Form {
                                                  TopMost = true, MinimizeBox = false,
                                              }, "some text", "some topic", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
        } finally {
            if (result == DialogResult.No) {

            }
        }
MadBoy