Message window over splash screen

I have a message that appears when the user cannot be downloaded (in this case, because he does not have a warehouse) during the download, there is a splash screen that shows that the data is being downloaded. I tried setting TopMost to true, but yes, spalshscreen is not a parent, so it does not work, so I tried to set TopLevel to true, but that did not help.

So I tried:

MessageBox.Show(Splashscreen.LoadingScreen.ActiveForm, e.Message, "No warehouses", MessageBoxButtons.OK, MessageBoxIcon.Error);

but this is a cross-stream, so I get: InvalidOperationException So is there any other way to set the top message box?

+4
source share
2 answers

Try this, it will show your MessageBox at the top of every window that is currently open.

MessageBox.Show(this,
        "Your text",
        "Settings Needed",
        MessageBoxButtons.YesNo,
        MessageBoxIcon.Question,
        MessageBoxDefaultButton.Button1,
        (MessageBoxOptions)0x40000); // this is MB_TOPMOST flag

, MB_TOPMOST MessageBoxOptions. .

+7

- MessageBox SplashScreen. "this", " " WPF.

MessageBox.Show(msg, errType, MessageBoxButton.OK, 
    MessageBoxImage.Asterisk, reply, MessageBoxOptions.ServiceNotification);

MessageBoxOptions.ServiceNotification , MessageBox SplashScreen.

+1

Source: https://habr.com/ru/post/1543025/


All Articles