惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
AI
AI
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
V
Visual Studio Blog
博客园 - Franky
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
Intezer
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
SegmentFault 最新的问题
腾讯CDC
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Webroot Blog
Webroot Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
小众软件
小众软件
C
Cyber Attacks, Cyber Crime and Cyber Security
Hacker News: Ask HN
Hacker News: Ask HN
T
Tor Project blog
WordPress大学
WordPress大学
雷峰网
雷峰网
J
Java Code Geeks
GbyAI
GbyAI
Recorded Future
Recorded Future
F
Full Disclosure
Cisco Talos Blog
Cisco Talos Blog
S
Secure Thoughts
I
InfoQ
量子位
Forbes - Security
Forbes - Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threatpost
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
Attack and Defense Labs
Attack and Defense Labs
爱范儿
爱范儿
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
L
LINUX DO - 最新话题
A
Arctic Wolf
S
Security Affairs

博客园 - amey

不错的blog 系统内置的图片资源---android.R.drawable android 开发不容错过的网站 Android风格与主题(style and theme) Android中的长度单位详解 startActivity 出错 main cannot be resolved or is not a field Android DDMS如何使用? 网上绝无仅有的Log分析教程及例子(转) 如何控制Android不锁屏 Android系统名词解释汇总 - Android讨论区::91手机论坛-91手机娱乐门户 Android开发中的drawable-(hdpi,mdpi,ldpi)和WVGA,HVGA,QVGA的区别以及联系 每一位想有所成就的程序员都必须知道的15件事(转载) MSDN一篇很好的WCF入门教程(转) GetManifestResourceStream的使用 使用Refactor找回被覆盖的代码 第一次制作.hlp文件格式的帮助文档 windows应用程序名要与配置文件命名一致 [windows编程]error C2664: “MessageBoxW”: 不能将参数 2 从“char *”转换为“LPCWSTR” - amey
如何控制静态Form类与普通的Form类之间的切换
amey · 2011-01-14 · via 博客园 - amey

  当我们在wm项目中需要经常显示一个窗体(比如是地图显示的窗体),而且这个窗体中显示的东西又比较多时,我们可以考虑在该窗体中定位一个单例模式的静态对象:

代码如下:

       #region
        private static readonly MapForm _instance = new MapForm();
        #endregion
        #region Properties
        public static MapForm Instance
        {
            get
            {
                return _instance;
            }
        }

   #endregion

  接下去当我们在别的窗体中调用并显示MapForm时,如下代码:

   MapForm.Instance.Show();

   MapForm.Instance.TopMost=True;

      然而,当我们关闭这个窗体时,如果没有通过该窗体的Closing事件使窗体处于隐藏的状态的话,下次再调用该MapForm窗体时,会出现该MapForm窗体的Menu菜单不可用,原因是刚才关闭窗体时,没有通过Closing事件个来完成如下的代码操作。

   private void MapForm_Closing(object sender, CancelEventArgs e)
        {
            e.Cancel = true;

            Visible = TopMost = false;
        }

     怎么样才能触发Closing事件呢,答案是把MapForm的MinimizeBox设为false,窗体在新建时MinimizeBox是为true的。默认情况下,show()窗体时,窗体的左上角是打叉的按钮,如果将MinimizeBox设为false,show()窗体时,窗体的左上角是OK的按钮。

  当然,如果你显示MapForm.ShowDialog()时,窗体的左上角是OK的按钮。