BUG: An MDI child form may not maximize if the child form contains an ActiveX control in Visual Studio .NET 2003 (871045)
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
SYMPTOMSWhen you use an ActiveX control in a Multiple-Document
Interface (MDI) child form in Microsoft Visual Studio .NET 2003, you may
experience the following problems:
- The MDI child form may not maximize.
- You cannot change focus to another inactive
MDI child form if you click the client area of the inactive
MDI child form.
CAUSEThis problem occurs because your application may not treat forms as
correct MDI child forms when the following conditions are true: - You work with Microsoft Windows forms in MDI mode in Visual Studio .NET
2003.
- You use an ActiveX control in an MDI child form.
WORKAROUNDTo work around this
problem, use one of the following methods: Method 1Modify the code so that you can maximize the child form, and then modify the code so that you can obtain the focus of an inactive child form: Method 2Set the MdiParent property and the WindowState
property of the child form before you call the InitializeComponent method in the
child form. To do this, you must write code that creates a constructor
that takes the MdiParent property and the WindowState property as arguments and that creates a form as an MDI child form:
- In Solution Explorer, right-click the
Form2.vb file, and then click View
Code.
- Locate the following code in the Form2
class:
Public Class Form2
Inherits System.Windows.Forms.Form - Add the following code after the code that you located in
step 2:
Public Sub New(ByVal mdiParent As Form, ByVal initialState As FormWindowState)
MyBase.New()
Me.MdiParent = mdiParent
Me.WindowState = initialState
InitializeComponent()
End Sub The constructor initializes the MdiParent property of the child
form to specify the parent form. The constructor also initializes the WindowState property
of the child form before the constructor calls the InitializeComponent method. - Change the code in step 14 of the "More Information"
section to the following:
Dim frm As Form2
frm = New Form2(Me, FormWindowState.Maximized)
frm.Show()
You must change the code in all the MDI child forms that
contain an ActiveX control if you want to work around the problems that the "Symptoms" section mentions. STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbForms kbBug kbtshoot KB871045 kbAudDeveloper |
---|
|