TCanvas.StretchDraw
paints a graphic onto a canvas in a given rectangular area. The rectangle should, but does not need to be, within the bounds of the canvas. The owner of the canvas determines those bounds. In your case, it sounds like the canvas owner is the TGraphicControl
object.
If you want two graphics to be painted beside each other, then the TRect
you use to draw the first graphic should represent a rectangle that is adjacent to the TRect
you use for the second graphic. You haven't shown any code yet, so it's hard to tell what's going wrong.
If you use the same TRect
variable for both calls to StretchDraw
, then you need to make sure you modify the rectangle's position between the calls — change the Left
property, for starters.
For example:
var
r: TRect;
begin
r := ClientRect;
// First rectangle takes up left half of control
r.Right := r.Right div 2;
Canvas.StretchDraw(r, graphic1);
// Shift the rectangle to the right half
r.Left := r.Right;
r.Right := ClientRect.Right;
Canvas.StretchDraw(r, graphic2);
end;