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

推荐订阅源

博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
月光博客
月光博客
AI
AI
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CXSECURITY Database RSS Feed - CXSecurity.com
WordPress大学
WordPress大学
GbyAI
GbyAI
L
Lohrmann on Cybersecurity
O
OpenAI News
Schneier on Security
Schneier on Security
P
Palo Alto Networks Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
L
LINUX DO - 最新话题
人人都是产品经理
人人都是产品经理
S
Security Affairs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
Recorded Future
Recorded Future
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
The Hacker News
The Hacker News
Y
Y Combinator Blog
Latest news
Latest news
SecWiki News
SecWiki News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
L
LINUX DO - 热门话题

博客园 - Alter-it

新群-客户需求 IT人员的出路在哪里? 雅虎邮箱outlook设置 1 2 3 工作、学习 控制输入数字的script - Alter-it - 博客园 转贴:无法复制iisapp.vbs或staxmem.dll文件,需要sp1光盘 不要懦弱 网上寻梦的日子 Just do it DNS,上海花生壳DNS解析错误,只好用别的了。 郁闷了两天的web项目打包问题,欧了 JavaScript有用的代码,摘抄自:http://bbs.tech.163.com/board/rep.jsp?b=tech10&i=1296&p=0 - Alter-it - 博客园 我变成了一个挑剔的人 让人郁闷了好久的问题,终于解决了,之前网上也看到一些解决方法,但大多没有解决问题,所以记录下来,以供参考之用(ADO Could Not Find The Specified Provider) - Alter-it 一点感想 纯粹欺骗 AJAX CodeSimith使用记录 CodeSmith……我慢慢起步
.NET 2005界面渲染疑问
Alter-it · 2007-04-21 · via 博客园 - Alter-it

这些日子在做一个WinForm的小工具,开始拿起好久不用的.NET了,C#,VS.2005 确实有好些改进,方便不少,也比之前的2003好用的多,这些就不说了,还是说说我遇到的问题吧。
Mdi窗体上有一个主菜单,设置是自动改变大小的(AutoSize=true),在加载其他子窗体(子窗体打开的时候自动最大化)的时候,子窗体的Icon有时候会显示的不正常(应该显示在菜单的左上角),有时候就会显示成默认(没有设置Icon)Icon 。
后来写了一个静态方法来调用,专门用来调整这个问题,这里拿出来分享一下,如果有什么更简单的方法解决这个问题,希望大家给我留言,^_^.
以下是针对这个问题写的一个类:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace FormAddition
{
    public class Act
    {
        /// <summary>
        /// 加载子窗体的时候,调整子窗体的Icon显示问题
        /// </summary>
        /// <param name="tobeActive">需要加载的子窗体</param>
        /// <param name="Mdi">主窗体:Mdi窗体</param>
        public static void ActiveFrm(Form tobeActive, Form Mdi)
        {
            for (int i = 0; i < Mdi.MdiChildren.Length; i++)
            {
                if (Mdi.MdiChildren.GetValue(i).Equals(tobeActive))
                {
                    tobeActive.WindowState = FormWindowState.Normal;
                }
            }
            tobeActive.WindowState = FormWindowState.Maximized;
        }

    }
}

在加载显示子窗体的代码之后加上这样一句就可以正常显示了:
//_importing = new frmImporting();
// _importing.MdiParent = this;
// _importing.Tag = this;
// _importing.Show();
Act.ActiveFrm(_importing, this);

就这样,虽然很简单,但也是调试了好久才得出来的结果,呵呵。因为没怎么研读VS.2005的帮助文档,所以如果这个问题让大伙笑话了,也欢迎批评批评啊!