Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window Flicker on loss of focus?

I have been working on a windows form application based in c# and I am in need of some assistance. I am trying to recreate the window flicker that most windows applications have when a form loses focus to a parent form. Best way I can explain this is open up calculator open the help window and try to click the calculator, the help window then without falling behind the calculator flickers losing and gaining the shadowing around the edges.

I have managed to regain the focus on the child window when the parent is clicked but this creates a odd flickering effect as the parent window is momentarily brought in front of the child window. I am only guessing but that effect I am looking for appears to be that the calculator is never brought in front of the help window and then the help window is simply activated and deactivated a few times.

I tried doing some searches and I have seen a few topics relating to this but none of the solutions quite match. I am fairly new to making windows form applications so there are still a things I don't understand so be patient with me if I don't understand something at first.

Thank you in advance

An elaboration on the calculator example:

1) open up calculator from windows accessories 2) in the toolbar go to the help tab and open the about calculator option 3) click on the calculator window 4) the about calculator window will then flicker while never falling behind the calculator

The only progress I have made towards this is

    private void MainForm_Activated(object sender, EventArgs e)
    {
        if (Open == true)
        {
            //blink active window

            _addForm.Activate(); //makes window active
        }
    }

The open variable is something I use to keep track of if open forms and is made true when I show another form.

like image 960
Jesse Avatar asked Apr 19 '13 14:04

Jesse


People also ask

Why does my screen flicker Windows?

Screen flickering in Windows is usually caused by display drivers. To update your display driver, you'll need to start your PC in safe mode, uninstall your current display adapter, and then check for driver updates. Start your PC in safe mode, then select and hold (or right-click) Start and select Device Manager.

How do you fix a glitching window screen?

Fix your display driver If Windows Update recently made updates to your device, roll back your display driver. Otherwise, try updating or uninstalling your display driver to fix the flickering or scrambling problem. In the search box on the taskbar, enter device manager, and then select it from the list of results.

What causes flickering flickering?

Again, most flickering is caused by an old, faulty or incompatible wall switch or bulbs that are loose or of poor quality. There's a good chance that your lighting issues can be addressed by a quick fix like replacing a dimmer or swapping out a light bulb.

How do I get rid of flickering problems?

If your screen is still flickering, try adjusting your brightness settings, and disabling the adaptive brightness feature. Corrupted data in the system on your device can sometimes cause the screen to flicker. Clear the cache on your device, then check if the flickering continues.


1 Answers

In your example the About window is called a modal window. A modal window prevents the user from interacting with the parent window until it is closed. Use Form.ShowDialog instead of Form.Show to present a Form to the user as a modal window.

like image 82
RogerN Avatar answered Sep 30 '22 09:09

RogerN