I had this working in previous test program but after moving into my full project it did not. The difference is down to different order of operations. Under test I was
-creating a form dynamically with TImage (align set to acClient) with random size
-setting the background to white
-then drawing on the image.
The new process
-creates the form dynamically the same was with TImage (align set to acClient) with a fixed size
-calculates coords and
sets form to new size/position-then draws on the image.
What happens is that the area drawn to (cleared) is the same size as the form that the dynamically created form is based on.
frm.Image1.Canvas.Line(0, 0, frm.image1.Width-1, frm.image1.Height-1);
frm.Image1.Canvas.Line(0, frm.image1.Height-1,frm.image1.Width-1 ,0);
draws the red lines and seems to understand the actual image1 size.
frm.Image1.Canvas.FillRect(frm.image1.BoundsRect);
but this which I found somewhere seems not to. I am missing something but what? The attached project Test12.zip contains just enough of my program to simulate the problem
Thanks