15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


How to autosize an ActiveX control to the Containers size?

bshamsian@ccvhs.vhsla.com
Tuesday, February 11, 1997

     
     Environment : Visual C++ 4.2b , Win95, NT 4.0 Workstation 
     
     
Hello,
     
Is there a way for a Control to be notified when the container's size has
changed?  I need to make control that changes it's size when the size of
the container has changed.  For example it will have an AutoSizeToParent
property which when set will enable the control to maximize itself to the
full size of the container.


Any help is greatly appreciated
Ben (bshamsian@vhsla.com)




Mike Blaszczak -- mikeblas@nwlink.com
Wednesday, February 12, 1997

At 09:00 2/11/97 PST, bshamsian@ccvhs.vhsla.com wrote:
>     Environment : Visual C++ 4.2b , Win95, NT 4.0 Workstation 

>Is there a way for a Control to be notified when the container's size has
>changed? 

When the container changes the size of its window, it can call the
SetExtent() method on the control's IOleObject interface to tell the
control about the window's new size and shape.

>I need to make control that changes it's size when the size of
>the container has changed. 

This needs to be done by the container, not by the control.  The control
is a server--it does whatever the container tells it, not the other
way around.

>For example it will have an AutoSizeToParent
>property which when set will enable the control to maximize itself to the
>full size of the container.

If the control knows it has a window, it can get the parent of that window
and that _should_ be the window containing the control.  The control
can measure that size and _request_ the container size it like that,
but the container is free to ignore or override that request.

This request can be put through the control's
IOleInPlaceSite::OnPosRectChange() method.


.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
           This performance was not lip-synched.





Become an MFC-L member | Вернуться в корень Архива |