Page 1 of 1

Bug in TPrintPreview.PaintGraphic

PostPosted: September 12th, 2012, 8:17 am
by seekbirdy
Hello!

Thanks a lot for a good work!
I think I found a small bug in TPrintPreview.PaintGraphic() function in several latest releases:
Code: Select all
function TPrintPreview.PaintGraphic(X, Y: Integer; Graphic: TGraphic): TPoint;
var
  Rect: TRect;
begin
  Rect.Left := X;
  Rect.Top := Y;
  Rect.BottomRight := ScreenToPreview(Graphic.Width, Graphic.Height); //problem is here - begin coordinates of a rect are not applied
  Result := PaintGraphicEx(Rect, Graphic, False, False, False).BottomRight;
end;
,

so, the fix could be e.g. the following:
Code: Select all
function TPrintPreview.PaintGraphic(X, Y: Integer; Graphic: TGraphic): TPoint;
var
  Rect: TRect;
  pt: TPoint;
begin
  Rect.Left := 0;
  Rect.Top := 0;
  Rect.BottomRight :=  ScreenToPreview(Graphic.Width, Graphic.Height);
  OffsetRect(Rect, X, Y);
  Result := PaintGraphicEx(Rect, Graphic, False, False, False).BottomRight;
end;


Mvg,
Ilya.

Re: Bug in TPrintPreview.PaintGraphic

PostPosted: September 12th, 2012, 10:44 am
by Kambiz
Thant's true.
Thank you very much.