Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying a MessageBox on top of all forms, setting location and/or color

I have two forms and I set one of the forms' TopMost property to true. Somewhere, while the program runs, I show a MessageBox, but since TopMost is set to true, when the MessageBox pops up it shows under the topmost form so I cannot see it.

  1. Is there any way that I make one of my forms always be on top, but when a MessageBox pops up, make the message box show on top of that specific form?

  2. Is it possible to give a location to the MessageBox so that it shows not in the middle but for example low down on the screen?

  3. Let's say that I have an orange colored form can I have a pink colored message box only for that specific application. I mean I am NOT referring to playing the windows color properties. (I don't want all message boxes to be pink.)

like image 348
modest and cute girl Avatar asked Aug 10 '12 23:08

modest and cute girl


People also ask

How do I view MessageBox?

To display a message box, call the static method MessageBox. Show. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.

What is MessageBox class explain MessageBox () in detail?

A message box is a prefabricated modal dialog box that displays a text message to a user. You show a message box by calling the static Show method of the MessageBox class. The text message that is displayed is the string argument that you pass to Show.

What is return type of show () method of MessageBox class?

DialogResult is an enumeration of the possible return values of a dialog box including a MessageBox. The Show method returns a DialogResult that tells us what button a user has clicked on the message box.

Which is the default MessageBox button?

The second button on the message box is the default button.


1 Answers

I use this.

MessageBox.Show(
                "message",
                "title",
                MessageBoxButtons.OK,
                messageBoxIcon,
                MessageBoxDefaultButton.Button1,
                (MessageBoxOptions)0x40000); // this set TopMost
like image 55
Kim Ki Won Avatar answered Sep 19 '22 09:09

Kim Ki Won