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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 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的帮助文档,所以如果这个问题让大伙笑话了,也欢迎批评批评啊!