Article ID: 168326 - Last Review: November 21, 2006 - Revision: 2.4 How To Define the Display Size of an MFC ActiveX ControlThis article was previously published under Q168326 NOTE: Microsoft Visual C++ .NET (2002) supports both the managed code
model that is provided by the .NET Framework and the unmanaged native Windows
code model. Part or all of the information in this article applies to managed
Visual C++ code and may be applied only by using the .NET Framework.
On This PageSUMMARY Sometimes you need to limit an ActiveX control's minimum or
maximum size at design time. This article explains how to do this by overriding
the virtual COleControl::OnSetExtent method. MORE INFORMATION The COleControl::OnSetExtent method is called by
COleControl::XOleObject::SetExtent. COleControl::XOleObject is COleControl's
IOleObject implementation. A container calls IOleObject::SetExtent when it
needs to dictate to an embedded object the size at which it will be displayed.
COleControl::OnSetExtent takes one parameter, a pointer to a SizeL structure. The SizeL structure contains the new size that the container is requesting for the control in HIMETRIC units. If a you need to limit a control to a certain size, you need to make it override COleControl::OnSetExtent and do the following:
Sample CodeThe following code snippet shows how to override COleControl::OnSetExtent so that the height of the control will never be smaller than 20 pixels.APPLIES TO
| Article Translations
|
Back to the top
