在失去重心的窗口闪烁? [英] Window Flicker on loss of focus?

查看:125
本文介绍了在失去重心的窗口闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直基于C#中的Windows窗体应用程序,我需要一些援助。我试图重新创建窗口闪烁,当窗体失去聚焦到父窗体大多数Windows应用程序都有。我可以解释这种最好的方式就是打开计算器打开帮助窗口,并尝试点击计算器,帮助窗口则没有掉下计算器背后瞬失去和获得周围的边缘阴影。

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.

我试着做一些搜索,我已经看到了关于这几个主题,但没有解决方案的完全匹配。我是相当新的制作Windows窗体应用程序,因此仍然有事情我不明白,所以要耐心跟我,如果我不明白,在第一次的东西。

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.

谢谢你在前进

在计算器示例的阐述:

1)门窗配件打开计算器
2)在工具栏中转到帮助选项卡,打开约计算器选项
3)点击计算器窗口
4),则有关计算器窗口会闪烁,而从不跌倒计算器背后

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

我对这个是

    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.

推荐答案

在您的例子中,关于窗口所谓的模态窗口。模态窗口,防止用户直到关闭与父窗口进行交互。使用 Form.ShowDialog 而不是 Form.Show 来呈现形式提供给用户作为一个模态窗口。

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.

这篇关于在失去重心的窗口闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆