?
Solved

Custom MessageBox makes all the application flash

Posted on 2009-02-11
6
Medium Priority
?
253 Views
Last Modified: 2012-05-06
I have a form that is used as a custom message box, the code snippet attached is one of the ways it is called.

But I have a problem with this, when you click the OK button all the application flashes, and for a while you can see the applications that are backwards.

Am I doing something wrong with this?

Please help me.
public static DialogResult ShowBox(IWin32Window owner, string sMsg) 
        {
            myMsgBox = new MsgBox();
            myMsgBox.lblHeader.Text = "DOMI";
            myMsgBox.lblMessage.Text = sMsg;
            SetMessageBoxButtons(MessageBoxButtons.OK);
            SetMessageBoxIcon(MessageBoxIcon.None);
            SetMessageBoxDefaultButton(MessageBoxDefaultButton.Button1);
            SetResize(false);
            myMsgBox.TopLevel = true;
            myMsgBox.ShowDialog(owner);
            return result;
        }

Open in new window

0
Comment
Question by:JuanPabloPonce
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 23615932
you can try suspending layout for the form
 Form f = new Form();
                        f.SuspendLayout();
and then when you are done with the message box
f.ResumeLayout()

not sure if that will work in this case, or not.
0
 

Author Comment

by:JuanPabloPonce
ID: 23616152
Thanks for your anwer, but it doesn't worke in this case.
0
 
LVL 7

Expert Comment

by:illusio
ID: 23628120
Try:

DialogResult result = MessageBox.Show(owner, sMsg, "DOMI", MessageBoxButtons.OK, MessageBoxIcon.None);

Or drop the myMsgBox.TopLevel = True; <-- HORROR !!! It prevents you from using ANY program.

Kind regards.


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JuanPabloPonce
ID: 23628643
Thanks, I'll take in consideration the TopLevel suggetsion.

About the using of the standard MessageBox it is impossible, the idea is to have a custom message box that uses styles and colors.
0
 

Accepted Solution

by:
JuanPabloPonce earned 0 total points
ID: 23912946
Actually, this was an issue of a third party control that was solved by upgrading it's version.
0
 
LVL 22

Expert Comment

by:p_davis
ID: 23912956
thanks for the update
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question