Bug in TPrintPreview.PaintGraphic

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Bug in TPrintPreview.PaintGraphic

Postby seekbirdy » September 12th, 2012, 8:17 am

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.
seekbirdy
Active Member
Active Member
 
Posts: 7
Joined: September 12th, 2012, 8:08 am

Re: Bug in TPrintPreview.PaintGraphic

Postby Kambiz » September 12th, 2012, 10:44 am

Thant's true.
Thank you very much.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 35 guests

cron