January 25th, 2013, 07:45 PM
in my forms onactivate I have the following code;
var x,y : integer;
but this line is not showing on the form, because I have a big tshape rectangel over that position, and want the line to appear in the front of that, but it looks like it lays in the back. Anybody know how I can get the line in front??
January 26th, 2013, 01:34 AM
You can't, for two reasons.
- TShape drawing will always be done after your draw. So, your line will always be overwritten.
- The rest of the line (which did not get overwritten by the TShape) will be erased the next time the form refresh itself (i.e. handling WM_PAINT, WM_ERASEBKGND, and similar windows messages).
The quickest workaround would be to draw directly on the screen/desktop. But you need to synchronize both the time to draw (and erase the drawing should it needed) and location (because now you draw to the desktop, not on your form).
January 26th, 2013, 04:21 AM
Is there any other way of drawing lines from the onactivate procedure??
January 27th, 2013, 02:06 AM
The main problem is that your drawing will not persisted. It will be gone the next time the form refresh its display. I can't see why you need to do the drawing in OnActivate. You can just set a flag there and do the drawing in OnPaint event of the form (i.e. your drawing only to be done when the flag was set).
Btw, OnPaint will not be triggered unless previously OnActivated was fired. So actually you don't need to do the drawing in OnActivate or using flag.