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.
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Drawing to a canvas from a button click event
Drawing to a canvas from a button click event
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,
:= GetDC( ::Handle ), and used that to populate the oCanvas:hDC property.
Everthing works fine.
Regards,
Drawing to a canvas from a button click event
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
> 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
>>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.
with ReleaseDC( ::Handle, hDC ).<<
I didn't think of that, still not used to doing these things in Xbase. Ok,
thanks Jose, will do.