Board index » delphi » Please help: Drawing over controls on a form

Please help: Drawing over controls on a form

How do I draw on a form and over a control. Screen has no canvas, obviously
the form canvas gets clipped...
I want to draw a rectangle which is displayed whilst dragging

Thanks in advance, please email me on joh...@iol.ie

 

Re:Please help: Drawing over controls on a form


On 26 Sep 1996 13:00:08 GMT, "John Cunningham" <joh...@iol.ie> wrote:

Quote
>How do I draw on a form and over a control. Screen has no canvas, obviously
>the form canvas gets clipped...
>I want to draw a rectangle which is displayed whilst dragging

You can draw on the form's canvas, but you need to turn off clipping.
See SetWindowLong in the Windows API documentation. You need to set
the window style (Gwl_Style). See CreateWindow to learn about window
styles. Look for Ws_ClipChildren. Remember to turn clipping back on
when you are done drawing the rectangle.

Alternatively, you can change the form's canvas to a different DC, by
retrieving a DC from the cache, rather than using the form's own DC.
See GetDCEx for details (Dcx_Cache in particular).

--
Ray Lischner, Tempest Software, Corvallis, Oregon, USA
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Other Threads