Click here to Skip to main content
13,402,824 members (41,626 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 14 Sep 2011

MDI Parent Menu Client Maximized Icon Fix (workaround)

, 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

You may also be interested in...

Comments and Discussions

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

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

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

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