PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Jean-pierre Leroy on January 24, 2011, 11:55:18 AM

Title: Resize Rules and Custom control
Post by: Jean-pierre Leroy on January 24, 2011, 11:55:18 AM
Dear all,

it seems the "Resize rules" doesn't work for a Custom Control.

Is there any workaround for that ?

Thanks,
Jean-Pierre

Title: Re: Resize Rules and Custom control
Post by: Theo Gottwald on November 22, 2014, 06:04:07 AM
This problem is still open.
Title: Re: Resize Rules and Custom control
Post by: David Kenny on November 22, 2014, 02:32:03 PM
Here is a work around.

Create a label control (or whichever control you prefer) with the same Top, Left, Height, and Bottom specs as the custom control.  Give it the resizing rules you want the custom control to have.  Make it not-visible, but leave it enabled.  In the WM_Size message for the Parent form try this:Function MAINFRM_WM_SIZE ( _
                         hWndForm      As Dword, _  ' handle of Form
                         fwSizeType    As Long,  _  ' type of resizing request
                         nWidth        As Long,  _  ' new width of client area
                         nHeight       As Long   _  ' new height of client area
                         ) As Long
    Local   ctrlTop, ctrlLeft, ctrlHeight, ctrlWidth    As Long
                             
    FF_Control_GetLoc ( MainFrm.sizelabel.hWnd,  ctrlLeft,  ctrlTop )
    FF_Control_GetSize( MainFrm.sizelabel.hWnd,  ctrlWidth, ctrlHeight )
    FF_Control_SetLoc ( MainFrm.CustomCtrl.hWnd, ctrlLeft,  ctrlTop )
    FF_Control_SetSize( MainFrm.CustmCtrl.hWnd,  ctrlWidth, ctrlHeight )
End Function


Not ideal perhaps, but it works. :P