Search

Wednesday, August 27, 2008

How to Display Message Box Center to the Windows Form using C# sharp

how to center the Message Box center to the Form instead of Computer Screen in visual C#? when i first designed UI for the application i faced the above problem so after a brief search i came to know that we have to design our own message control in C# using win32 API's there are lot of samples floating around the net but the code found in below link worked awsome for me

http://69.10.233.10/KB/dialog/CenterDialog.aspx

above is the link which contains code just download it compile and use the DLL in your project it is as simple as that ex after including the DLL in your project instead of Messagebox.show you can use MsgBox.Show and everything including parameters passed will be the same that is

Messagebox.show("Sample Msgbox","Sample",MessageBoxButtons.OK, MessageBoxIcon.Warning)

MsgBox.Show("Sample Msgbox","Sample",MessageBoxButtons.OK, MessageBoxIcon.Warning)

above both the message box are same except the second one will be centered to the windows form where as first one will be centered to the whole screen

1 comments:

Anonymous said...

Who in their right mind wants to do all that... just to have a feature that should ALREADY be a part of MessageBox: Center the pop-up over my program... not far off somewhere else.

Post a Comment

Other Interesting Articles



Related Article Widget by Yogith

Search Powered by Google