No doubt I'm making some mistake, because nothing shows. All I managed to do so far is to make the invisible paintbox clickable.
No doubt I'm making some mistake, because nothing shows. All I managed to do so far is to make the invisible paintbox clickable.
Update:
While cleaning up the code mess suddenly at least something appeared on the paintbox.
That is a rectangle painted in Green. For reference I had an image (imgRight) next to the painbox...
The code below painted the image red and the painbox green. Unfortunately no persistence.
As soon as either part was clicked the paintbox became erased / invisible
Still better than previous attempts.
Code snippet for initiating the coloring below.
recMAIN.canvas.Brush.Color := clRed;
recMAIN.canvas.FillRect(jPaintBoxWidd, 0, jRecMainWidd, jRecMainHei);
paintBox1.canvas.Brush.Color := clGreen;
paintBox1.canvas.FillRect(0, 0, jPaintBoxWidd, jRecMainHei);
imgRight.canvas.copyrect(rect(0, 0, jRecMainWidd, jRecMainHei),
recMAIN.canvas, rect(jPaintBoxWidd, 0, jRecMainWidd, jRecMainHei));
Where do you call this code?
Just a test program. The code snippet is is called by clicking a panel
That is the problem. This code should be inside OnPaint event of TPaintBox. Your click should only call PaintBox.Invalidate. This then forces the paint box to start redrawing itself and consequently also executes the OnPaint event. Of course before and after OnPaint event some additional needed code is also automatically called.
Thanks. I'll have to try that![]()
Seems to work. I'll try a new mini project with this method. Thanx Silver
Bookmarks