Container resized by control 
Author Message
 Container resized by control

I have ATL control that have n-lines of text. When i am changing a font, making
it bigger, control size is changing and container should be automatically resized.

I implemented OnConrolResize( int iWidth, int iHeight )function for that purpose
that send event to container. Problem is how to calculate iWidth and iHeight
inside ATL control. There are different types of units. I am using the following:

/***************************************************************/
HDC hdc;
TEXTMETRIC  tm;
SIZEL sizeMetric, sizePixel;

SelectObject( hdc, m_hTextFont );
::GetTextMetrics(  hdc, &tm );
ReleaseDC(hdc);

sizeMetric.cx = tm.tmAveCharWidth*50; //just for sample
sizeMetric.cy = tm.tmHeight*100;      //just for sample

AtlHiMetricToPixel( &sizeMetric, &sizePixel );

Fire_OnControlResize(  sizePixel.cx,  sizePixel.cy );

/***************************************************************/

Container is resized, but in wrong way. Can anybody suggest sample code
that resize container from control?

*TKS*  



Sun, 25 May 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. how to resize controls with the resizing of dialog box

2. how to automatically resize controls on window resize ?

3. Resizing Controls when the dialog is resized

4. Controls in dialog resizing when window resizes

5. Control Resize AFTER Form Resize

6. resizing ActiveX in container

7. retrieve handle of the control from within the control when the container is vb

8. ActiveX "control-container" control

9. container control that runs its children controls in an other thread

10. How to enumerate controls placed on a Control Container

11. Resizing a control in a Rich Text control...

12. Having a container vested in another container

 

 
Powered by phpBB® Forum Software