Paint on Static

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Paint on Static

#1 Post by c-tec »

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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Paint on Static

#2 Post by Auge_Ohr »

greetings by OHR
Jimmy

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Paint on Static

#3 Post by c-tec »

Hello Jimmy,
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 )
I get the correct hDC1 handle, but no pixels are drawn, what I am missing ?
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Paint on Static

#4 Post by c-tec »

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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Paint on Static

#5 Post by c-tec »

Hello,
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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply