Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
%GripperSize = 10
%Cursor_NESW = 8
#Include "Win32API.inc"
Global hDlg As Dword
Global resizePT As Point
Global CapW, CapH, StartX, StartY, ResizeInWork As Long
Function PBMain() As Long
CapW = 160 : CapH = 160
Dialog New Pixels, 0, "PowerBASIC",300,300,CapW,CapH, %WS_Popup To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pt As Point
Select Case Cb.Msg
Case %WM_ContextMenu
Dialog End hDlg
Case %WM_SetCursor
GetCursorPos pt : ScreenToClient hDlg, pt
If (pt.x > (CapW-%GripperSize)) And (pt.y > (CapH-%GripperSize)) Then
MousePtr %Cursor_NESW : Function = 1
End If
Case %WM_LButtonDown
GetCursorPos pt : ScreenToClient hDlg, pt
If (pt.x > (CapW-%GripperSize)) And (pt.y > (CapH-%GripperSize)) Then
'in resize area
SetCapture hDlg
resizePT = pt
startX = CapW : startY = CapH
ResizeInWork = 1 'on marker
Else
If Cb.WParam = %MK_LBUTTON Then SendMessage hDlg, %WM_NCLButtonDown, %HTCaption, ByVal %Null ' force drag
End If
Case %WM_MouseMove
GetCursorPos pt : ScreenToClient hDlg, pt
If ResizeInWork Then
CapW = Max(startX + (pt.x - resizePT.x), 20)
CapH = Max(startY + (pt.y - resizePT.y), 20)
Dialog Set Size hDlg, CapW, CapH
End If
Case %WM_LButtonUp
ResizeInWork = 0
ReleaseCapture
MousePtr 1
Dialog ReDraw hDlg
End Select
End Function
'gbs_01380
'Date: 10-17-2014
http://www.garybeene.com/sw/gbsnippets.htm