#include "FiveWin.ch"
static oWnd, lBoxDraw := .f., nBoxTop, nBoxLeft, nBoxBottom, nBoxRight
function Main()
DEFINE WINDOW oWnd TITLE "Test"
oWnd:bLClicked = { | nRow, nCol | MouseDown( nRow, nCol ) }
oWnd:bLButtonUp = { | nRow, nCol | MouseUp( nRow, nCol ) }
oWnd:bMMoved = { | nRow, nCol | MouseMove( nRow, nCol ) }
ACTIVATE WINDOW oWnd
return nil
function MouseDown( nRow, nCol )
lBoxDraw = .t.
nBoxTop = nRow
nBoxLeft = nCol
nBoxBottom = nRow
nBoxRight = nCol
SetCapture( oWnd:hWnd )
DrawBox()
return nil
function MouseUp( nRow, nCol )
if lBoxDraw
DrawBox()
lBoxDraw = .f.
ReleaseCapture()
endif
return nil
function MouseMove( nRow, nCol )
if lBoxDraw
DrawBox()
nBoxBottom = nRow
nBoxRight = nCol
DrawBox()
endif
return nil
function DrawBox()
RectDotted( oWnd:hWnd, nBoxTop,;
nBoxLeft, nBoxBottom, nBoxRight )
return nil
#include "FiveWin.ch"
static oWnd, lBoxDraw := .f., nBoxTop, nBoxLeft, nBoxBottom, nBoxRight, oBrush
function Main()
DEFINE BRUSH oBrush STYLE DIAGCROSS COLOR RGB(218,165,32)
DEFINE WINDOW oWnd TITLE "Box Test with Fill"
oWnd:bLClicked = { | nRow, nCol | MouseDown( nRow, nCol ) }
oWnd:bLButtonUp = { | nRow, nCol | MouseUp( nRow, nCol ) }
oWnd:bMMoved = { | nRow, nCol | MouseMove( nRow, nCol ) }
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
function MouseDown( nRow, nCol )
lBoxDraw = .t.
nBoxTop = nRow
nBoxLeft = nCol
nBoxBottom = nRow
nBoxRight = nCol
SetCapture( oWnd:hWnd )
DrawBox()
return nil
function MouseUp( nRow, nCol )
Local aRect1, aRect2, hPen
oWnd:GetDc()
hPen := CreatePen( 0, 1, RGB(54,54,54))
if lBoxDraw
DrawBox()
lBoxDraw = .f.
ReleaseCapture()
aRect1 := { 26,nBoxLeft,125,nBoxRight}
aRect2 := {185,nBoxLeft,395,nBoxRight}
FillRect(oWnd:hDc,aRect1,oBrush:hBrush)
FillRect(oWnd:hDc,aRect2,oBrush:hBrush)
endif
return nil
function MouseMove( nRow, nCol )
if lBoxDraw
DrawBox()
nBoxBottom = nRow
nBoxRight = nCol
DrawBox()
endif
return nil
function DrawBox()
RectDotted(oWnd:hWnd, 26,nBoxLeft,125,nBoxRight)
RectDotted(oWnd:hWnd,185,nBoxLeft,395,nBoxRight)
return nil
function MouseUp( nRow, nCol )
Local aRect1, aRect2
if lBoxDraw
oWnd:GetDC()
DrawBox()
lBoxDraw = .f.
ReleaseCapture()
aRect1 := { 26,nBoxLeft,125,nBoxRight}
aRect2 := {185,nBoxLeft,395,nBoxRight}
FillRect(oWnd:hDc,aRect1,oBrush:hBrush)
FillRect(oWnd:hDc,aRect2,oBrush:hBrush)
oWnd:ReleaseDC()
endif
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 59 guests