Click here to Skip to main content
Click here to Skip to main content

MDI Parent Menu Client Maximized Icon Fix (workaround)

By , 14 Sep 2011
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

Comments and Discussions

QuestionThanks Pinmembernaraayanan29-Sep-13 21:47 
AnswerRe: Thanks PinprofessionalPaw Jershauge30-Sep-13 8:21 
GeneralThanks Paw, I've experienced the same bug, I'd assume lots o... PinmemberAndrewHeard19-Sep-11 22:36 
GeneralRe: your welcome ;) PinmemberPaw 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 | Mobile
Web03 | 2.8.140415.2 | Last Updated 14 Sep 2011
Article Copyright 2011 by Paw Jershauge
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid