Search code examples
c#winformsdialog

Disabling Dialog Flashing C#


I have a populated ListView dialog. If a user clicks on an option in the ListView, a new dialog is shown above the ListView.

My problems is that when I click off of the new top-most dialog (onto the ListView behind it), the new dialog's borders flash/blink several times. The icon on the taskbar also flashes. I wish to disable the flashing, but cannot find a property to change.

To show my dialog, I use the following code:

    if (detail == null)
            detail = new Details(opt, val, user, desc, m_l);
    detail.ShowDialog();

Solution

  • Sounds like to me you are creating modal windows each time. And you cannot resume the previous dialogs until you dismiss your new top-most window.

    Take a look at this wikipedia article for information about modal dialogs.

    I would advise you look at how you are creating/showing your windows. In WPF you show windows via Show() or ShowDialog(), however, I do not know which type of ListView you are using

    EDIT: Per your comment, you want modal dialogs. The only ways I can think of even trying to remove the flashing is going into WINAPI. This doesn't seem like a job for .NET.

    I want to suggest a few things:

    • Take a look at options for showing each window. See this MSDN page
    • Take a look at the options for styling each window. See this MSDN page
    • Reconsider your design. I know this may take a lot of work, but having so many layers of windows is kind of unappealing to most users. Ultimately, I believe this option will make your application the best.