- Code: Select all Expand view
#INCLUDE "FIVEWIN.CH"
function CaptureSignaure( oOwner )
local oDlg, ;
oSig, ;
nHdc, ;
nOldX := -1, ;
nOldY := -1, ;
cFile := lower( GetTempDir() + "\signature.bmp" )
DEFINE DIALOG oDlg TITLE "Signature" OF oOwner FROM 0,0 TO 150,350 PIXEL
@ 15, 5 SAY oSig PROMPT "" SIZE 150, 40 PIXEL BORDER OF oDlg
@ 01, 5 BUTTON "Clear" SIZE 25, 10 PIXEL ACTION oSig:refresh(.t.) OF oDlg
@ 01, 60 BUTTON "Save" SIZE 25, 10 PIXEL OF odlg ACTION ;
( oSig:saveToBmp( cfile ), ;
oSig:refresh(.t.), ;
ReleaseDC( oSig:hWnd, oSig:hDC ), oDlg:end() )
nHdc := GetDC( oSig:hWnd )
oSig:bLButtonUp := { |x,y,z| DoDraw( nHdc, y+1, x+1,@noldx,@noldy ), nOldX := -1, nOldY := -1 }
oSig:bMMoved := { |x,y,z| DoDraw( nHdc, y, x ,@noldx,@noldy) }
oSig:bLClicked := { |x,y,z| DoDraw( nHdc, y, x ,@noldx,@noldy) }
ACTIVATE DIALOG oDlg CENTER
return cFile
*------------------------------------------------------------------------------------------
STATIC Function DoDraw( hDc, x, y, noldx, noldy )
If nOldX == -1 .And. nOldY == -1
nOldX := x
nOldY := y
MoveToEx( hDC, x, y )
Else
LineTo( hDc,x,y )
EndIf
RETURN Nil
*------------------------------------------------------------------------------------------
DLL STATIC FUNCTION MoveToEx( hWnd AS HDC, nX AS _INT, nY AS _INT, NULL AS _INT ) AS BOOL PASCAL LIB "coredll.dll"
Is it supposed to work? Can you test it on your environment? On my tets, it is not drawing.
Thank you,
Reinaldo.