The MessageBox always appears in the center of the screen. How can I change it’s location

Platform: WinForms| Category: Tips

Its looks like you cannot change this behavior of MessageBox. One solution is to derive your own MessageForm class from Form to display your message. Then call its ShowDialog method to show it after you set its Size, Location and StartPosition properties. (If you don’t set the StartPosition , then the Location is ignored.) One of the values for StartPosition is CenterParent which would center your new MessageForm.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.