The information in this article applies to:
SYMPTOMSWhen resizing your ActiveX control on a host form, the component controls or user-drawn graphics do not get resized. CAUSEYou do not have logic in the Resize event of the UserControl object to resize the component control(s) to the new size, or in the Paint event of the UserControl object to redraw the user-drawn graphics. RESOLUTIONAdd code to the UserControl's Resize and/or paint event to resize the component control(s) and user-drawn graphics. STATUSThis is behavior is by design. MORE INFORMATION
Even though you may want to have various effects when the developer resizes
your ActiveX control, Visual Basic has no way of determining how to handle
resize issues of your component controls. You can place code in the
UserControl_Resize event to handle the resizing in whatever manner you
wish. Resizing a Single ControlThe control is resized to fill the entire UserControl by using the following code:
Resizing a Control and a Label Side-by-SideThe label occupies the leftmost 20% of the user control. The textbox occupies the rightmost 75% of the user control. A 5% gap exists between them, as shown here:
Resizing a Shape Control with a Label Drawn Part-Way DownThe shape control fills the entire UserControl. The label occupies the full width and is drawn slightly above center as shown here:
The height of the label is assumed not to change in this example. To change
label height to be 30% of the UserControl height, add the 4th argument to
the Move method:
The change of the second argument to ScaleHeight * .28 is obtained by
substituting ScaleHeight * .3 for Label1.Height, giving:
Resizing User-Drawn GraphicsThe code draws a border around the UserControl and puts an 'X' in it. The ScaleMode needs to be in pixels for the border to paint correctly:
REFERENCESMicrosoft Visual Basic User's Guide, Chapter 4, Creating an ActiveX Control, Drawing the ShapeLabel Control Additional query words: kbVBp500 kbVBp600 kbdse kbDSupport kbVBp kbvbcc kbActiveX
Keywords : kbGrpVBDB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |