Custom MessageBox makes all the application flash

Posted on 2009-02-11
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;





            myMsgBox.TopLevel = true;


            return result;


Open in new window

Question by:JuanPabloPonce
    LVL 22

    Expert Comment

    you can try suspending layout for the form
     Form f = new Form();
    and then when you are done with the message box

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

    Author Comment

    Thanks for your anwer, but it doesn't worke in this case.
    LVL 7

    Expert Comment


    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.


    Author Comment

    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.

    Accepted Solution

    Actually, this was an issue of a third party control that was solved by upgrading it's version.
    LVL 22

    Expert Comment

    thanks for the update

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now