Resize Rules and Custom control

Started by Jean-pierre Leroy, January 24, 2011, 11:55:18 AM

Previous topic - Next topic

Jean-pierre Leroy

Dear all,

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

Is there any workaround for that ?

Thanks,
Jean-Pierre


Theo Gottwald


David Kenny

#2
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