Hello,
I need to paint on a static after creating a dialog. I get the coordinates for drawing in a custom eventhandler of the dialog. I know I need the presentation space for the static for this. What is the simplest and fastest way to draw on the static when I receive a event with coordinates for the point ? I have to show a signature in realtime when writing on the signature pad.
regards
Rudolf
Paint on Static
Re: Paint on Static
try this Class ( pure Xbase++)
http://bb.donnay-software.com/donnay/vi ... f=7&t=1967
http://bb.donnay-software.com/donnay/vi ... f=7&t=1967
greetings by OHR
Jimmy
Jimmy
Re: Paint on Static
Hello Jimmy,
thank you, now I try it with the GDI sample of eXpress++, but get no result:
I get the correct hDC1 handle, but no pixels are drawn, what I am missing ?
regards
Rudolf
thank you, now I try it with the GDI sample of eXpress++, but get no result:
Code: Select all
STATIC hDC1
//here I get the event for each pixel
oTmpClass:SignatureDataReceived := {|x,y|postappevent(xbeUser_PadWriting,x,y,oDlg)}
...
@ 175,0 DCSTATIC TYPE XBPSTATIC_TYPE_BITMAP OBJECT oStaticSign SIZE 700,350 PIXEL EVAL {|o|hDC1 := GetWindowDC(o:getHWnd())} COLOR GRA_CLR_BLACK,GRA_CLR_PALEGRAY ID "STATICSIGN"
DCREAD ....
STATIC FUNCTION MyHandler ( nEvent, mp1, mp2, oXbp, oDlg,aGetlist, aRef, lOk )
******************************************************************
DO CASE
CASE nEvent == xbeUser_PadWriting
setsignpixel()
dc_getrefresh(aGetlist,"STATICSIGN") // ??
//WTF "writing",nDevX,nDevY,nPress,nTimestamp,nDispWidth,nDispHeight ,oDlg
OTHERWISE
if !empty(oXbp)
oXbp:handleEvent( nEvent, mp1, mp2 )
endif
ENDCASE
RETURN .t.
function setsignpixel()
******************************************************************
static nColor
default nColor to AutomationTranslateColor(GraMakeRGBColor({255,255,255}),.f.)
SetPixel(hDC1,nDevX/10,nDevY/10,nColor)
return .t.
#command GDIFUNCTION <Func>([<x,...>]) ;
=> ;
FUNCTION <Func>([<x>]);;
STATIC scHCall := nil ;;
IF scHCall == nil ;;
IF snHdll == nil ;;
snHDll := DllLoad('GDI32.DLL') ;;
ENDIF ;;
scHCall := DllPrepareCall(snHDll,DLL_STDCALL,<(Func)>) ;;
ENDIF ;;
RETURN DllExecuteCall(scHCall,<x>)
GDIFUNCTION SetPixel( nHDC, x, y, n )
regards
Rudolf
Re: Paint on Static
Hello,
got it working ! the problem was a bitmap that I have loaded bevore painting, so the bitmap was over the static and I could not see the points when wr.iting on the pad.
No I need a trick to change the size of the pixels for drawing, one pixel is too small. I have to paint a lot another pixels arount I think.
regards
Rudolf
got it working ! the problem was a bitmap that I have loaded bevore painting, so the bitmap was over the static and I could not see the points when wr.iting on the pad.
No I need a trick to change the size of the pixels for drawing, one pixel is too small. I have to paint a lot another pixels arount I think.
regards
Rudolf
Re: Paint on Static
Hello,
not perfect, but working:
regards
Rudolf
not perfect, but working:
Code: Select all
function setsignpixel()
******************************************************************
local nStartY,nStartX,x,y,nColor := AutomationTranslateColor(GraMakeRGBColor({0,0,0}),.f.),nSize := 6
nStartX := (oVarPad:nDevX/10) - (nSize/2)
nStartY := (oVarPad:nDevY/10) - (nSize/2)
for x := 1 to nSize
for y := 1 to nSize
SetPixel(oVarPad:hDC1,nStartX++,nStartY,nColor)
next y
nStartX := (oVarPad:nDevX/10) - (nSize/2)
nStartY++
next x
return .t.
regards
Rudolf