Página 1 de 1

Drawing to a canvas from a button click event

Publicado: Vie Jul 20, 2007 11:32 pm
por Guest
Jose,
Thanks for the sample, I had fun with it. I'm trying now to paint the rectangle,
from another method, other than an event which triggers the FormPainted method.
Is that possible? It doesn't work, in the attached sample.
In the updated sample, the attempt is to paint a large part of the spectrum
in the rectangle. But nothing visible happens; there's clearly something
I'm misunderstanding.

Drawing to a canvas from a button click event

Publicado: Sab Jul 21, 2007 7:14 pm
por Guest
Never mind, got it. In the TestPaint function, I retrieved the hDC from hDC
:= GetDC( ::Handle ), and used that to populate the oCanvas:hDC property.
Everthing works fine.
Regards,

Drawing to a canvas from a button click event

Publicado: Lun Jul 23, 2007 11:39 pm
por notelo
DGauss,
> Never mind, got it. In the TestPaint function, I retrieved the hDC from hDC
> := GetDC( ::Handle ), and used that to populate the oCanvas:hDC property.
I haven't see the code but remember to release the DC after the painting
with ReleaseDC( ::Handle, hDC ).
Regards,
José Lalí­n

Drawing to a canvas from a button click event

Publicado: Dom Jul 29, 2007 3:44 am
por Guest
>>I haven't see the code but remember to release the DC after the painting
with ReleaseDC( ::Handle, hDC ).<<
I didn't think of that, still not used to doing these things in Xbase. Ok,
thanks Jose, will do.