Dear FF users,
I would like to know if it is possible to draw a resize grip on the right lower edge of a FORM without using a statusbar ?
Thanks.
Jean-Pierre
Hi Jean-Pierre,
This code is based on something Dominic posted over on the PB Forums: http://www.powerbasic.com/support/pbforums/showthread.php?t=35982
%IDC_FORM1_SIZEBOX1 = 100
'--------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
hWndForm As Dword, _ ' handle of Form
ByVal UserData As Long _ ' optional user defined Long value
) As Long
' Create the Sizebox1 size box
Local hWndControl As Dword
hWndControl = CreateWindowEx( %Null, _ ' extended styles
"Scrollbar", _ ' class name
"", _ ' caption
%WS_CHILD Or %WS_VISIBLE Or _ ' window styles
%SBS_SIZEGRIP Or %SBS_SIZEBOXBOTTOMRIGHTALIGN, _ ' class styles
0, 0, _ ' left, top
0, 0, _ ' width, height
hWndForm, %IDC_FORM1_SIZEBOX1, _ ' handle of parent, control ID
App.hInstance, ByVal %Null)
End Function
'--------------------------------------------------------------------------------
Function FORM1_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
' Move the size gripper into place (bottom right corner of the form)
Local hWndControl As Dword
hWndControl = GetDlgItem( hWndForm, %IDC_FORM1_SIZEBOX1 )
SetWindowPos hWndControl, 0, nWidth - 17, nHeight - 17, 17, 17, %SWP_NOZORDER
End Function
or you can use GDI+
'Nachricht zeichnen
Case %WM_PAINT
GetClientRect(hWndForm , tRect)
hDC = BeginPaint(hWndForm, ps)
Call GdipCreateFromHDC(hDC, hGraphics)
'Erzeuge Stift 01 zum Zeichnen
Call GdipCreatePen1(%ColorsMagenta, 2, %UnitPixel, hPen)
'Zeichnen der Linie mit Stift
GdipDrawLineI hGraphics, hPen, tRect.nRight - 05, tRect.nBottom, tRect.nRight, tRect.nBottom - 05
GdipDrawLineI hGraphics, hPen, tRect.nRight - 10, tRect.nBottom, tRect.nRight, tRect.nBottom - 10
GdipDrawLineI hGraphics, hPen, tRect.nRight - 15, tRect.nBottom, tRect.nRight, tRect.nBottom - 15
Call EndPaint(hWndForm, ps)
Thank you Paul for this snippet, it is exactly what I was looking for.
Rudolf, thank you for the GDI+ code; I will test it also.
Jean-Pierre