Hey guys, I've been having a problem with my program. I've created a custom control which is meant to act just like a label. The control takes a function I created called getTotalSize, to get the total size of the text using measureString. It uses this method to draw out the text onto the control. When I startup the program, the text is drawn completely fine, but if I hide the text in any way (drag something in front of it, minimize it, move the form off the screen, etc.) and then make it visible again, the program throws an exception inside my getTotalSize method, right at the e.Graphics.MeasureString part. The error states that the "Parameter is invalid".

private float getTotalSize(messageInfo[] messages, PaintEventArgs e)
    SizeF size = new SizeF(0.0f, 0.0f);
    foreach (messageInfo myMessage in messages)
        // If there is no message, skip it
        if (myMessage == null)

        Font myFont = myMessage.font;
        string myStr = myMessage.message;

        size += e.Graphics.MeasureString(myStr, myFont); // ERROR HERE
    return size.Width;
I check the font right at the error, and for some reason it's height suddenly disappears and has an error inside of it:

myFont.Height.base.Message : Parameter is not valid.
myFont.Height.base.Source : System.Drawing
myFont.Height.base.StackTrace :
at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()

If anyone has any suggestions at all on what's going on and how I can fix this, it'd be greatly appreciated. Thank you. Happy holidays.