BUG: The controls on the form do not render correctly if you set the ControlBox property to False or set the Text property to an empty string in the form load event (814352)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
SYMPTOMSIf you perform one of the following steps in the form load
event, the controls on the form do not render correctly:
- Set the Text property of the form to an empty string.
- Set the ControlBox property of the form to False.
If you set the Text property or the ControlBox property in this way, the controls are not painted. You may not
be able to see the controls correctly on the form. With multiple-document
interface (MDI) forms, the parent form of a MDI application is not correctly
painted. However, this behavior may not occur for MDI child
forms. CAUSEThis issue occurs when the Invalidate method invalidates a specific region of the control. The Invalidate method sends a paint message that paints the control. You
invalidate the controls on the form if you set either of the properties as
mentioned in the "Symptoms" section of this article. However, the Invalidate method is not called when these properties are set in the form
load event.WORKAROUNDTo work around this issue, use one of the following methods:
- Call the Refresh method of the form after the code in the Form1_Load event.
This forces the controls to invalidate their
client area, redraw themselves, and redraw any child controls.
- Write the code in the constructor of the form.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Minor | Last Reviewed: | 1/25/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbvs2002sp1sweep kbCtrl kbControl kbWindowsForms kbdraw kbbug KB814352 kbAudDeveloper |
---|
|