Click here to Skip to main content
11,709,537 members (50,708 online)
Click here to Skip to main content

Tagged as

MDI Parent Menu Client Maximized Icon Fix (workaround)

, 14 Sep 2011 CPOL 12.3K 1
Rate this:
Please Sign up or sign in to vote.
Ever noticed that the icon of a child form inside a MDI Parent, is not correctly displayed in the parent main menu strip, if the state of the child form is set to maximized before its shown.

Put this code into the MDI Parent form to fix that issue:
protected override void OnMdiChildActivate(EventArgs e)
            if (ActiveMdiChild != null && ActiveMdiChild.WindowState == FormWindowState.Maximized && this.MainMenuStrip != null && this.MainMenuStrip.Items.Count > 0)
                if (ActiveMdiChild.Icon != null)
                    Bitmap bmp = new Bitmap(16, 16);
                    using (Graphics gp = Graphics.FromImage(bmp))
                        gp.DrawIcon(ActiveMdiChild.Icon, new Rectangle(0, 0, 16, 16));
                    this.MainMenuStrip.Items[0].Image = bmp;


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...

Comments and Discussions

QuestionThanks Pin
naraayanan29-Sep-13 21:47
membernaraayanan29-Sep-13 21:47 
AnswerRe: Thanks Pin
Paw Jershauge30-Sep-13 8:21
professionalPaw Jershauge30-Sep-13 8:21 
GeneralThanks Paw, I've experienced the same bug, I'd assume lots o... Pin
AndrewHeard19-Sep-11 22:36
memberAndrewHeard19-Sep-11 22:36 
GeneralRe: your welcome ;) Pin
Paw Jershauge21-Sep-11 20:39
memberPaw Jershauge21-Sep-11 20:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 14 Sep 2011
Article Copyright 2011 by Paw Jershauge
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid