Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, July 22, 2009 10:40:51 PM(UTC)
idtCapture1

Groups: Registered
Posts: 2


To Fit the image i make use of the PaintSizeMode property, but this property has no option to fit only the height of the image. I made a workaround to fit the height, but then sometimes a small border is displayed on the bottom of the image, see attachment, because LeadTools property PaintZoomFactor is an Integer and not a Real property like it should be, look at Adobe Reader that can also set Real zoompercentage. I program with Delphi 7 and use LEADTools Raster Imaging 14.5 dll. The workaround code:

var
zoomFactor: Integer;
zoomPercent: Real;
Viewer: TLEADImage;

begin
...
ftHeight:
begin
if (DoGetPageOrientation = 0) or (DoGetPageOrientation = 180) then
begin
if (Viewer.Width / Viewer.Height) > (Viewer.InfoWidth / Viewer.InfoHeight) then
Viewer.PaintSizeMode := smFit
else
begin
Viewer.PaintSizeMode := smZoom;
zoomPercent := (Viewer.Height - 3)* 100 / Viewer.InfoHeight;
DoSetPageZoomPercent(ContainerViewer, zoomPercent);
end;
end;
if (DoGetPageOrientation = 90) or (DoGetPageOrientation = 270) then
begin
if (Viewer.Width / Viewer.Height) > (Viewer.InfoHeight / Viewer.InfoWidth) then
Viewer.PaintSizeMode := smFit
else
begin
Viewer.PaintSizeMode := smZoom;
zoomPercent := ((Viewer.Height - 15) / Viewer.InfoWidth) * 100;
DoSetPageZoomPercent(ContainerViewer, zoomPercent);
end;
end;
end;
...
end;

Anybody suggestions?
idtCapture1 attached the following image(s):
FitHeight.JPG
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, July 23, 2009 6:37:24 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

If you want to have more accurate control over the display, you can manipulate the destination rectangle to exact pixel values instead of using an integer zoom factor.
For example, if you want to take into consideration a horizontal scrollbar when you fit the height, you can use code like this in the ELSE clause:
begin
   Viewer.AutoScroll := False;
   calcHeight := Viewer.Height - Viewer.HScrollInfo.Width;
   calcWidth := Viewer.BitmapWidth * calcHeight div Viewer.BitmapHeight;
   Viewer.SetDstRect(0, 0, calcWidth, calcHeight);
   Viewer.AutoScroll := True
end

where both variables calcWidth and calcHeight are integers.
 
#3 Posted : Friday, July 31, 2009 4:52:48 AM(UTC)
idtCapture1

Groups: Registered
Posts: 2


Thanks Basel, i adpated your code a bit and got it working now.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.123 seconds.