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



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, October 9, 2009 7:01:56 AM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 764

The LEADTOOLS .NET RasterImageViewer control's UseDpi property is designed to make the image display proportionally to the screen's resolution.  By default, Windows uses 96 for its screen resolution.  However, the screen resolution doesn't always match up with the physical world because different size screens can display the same number of pixels.  The result of this can mean that even though you have an image correctly sized to 8.5 x 11 inches, on the screen it might be more like 10 x 13 inches.
For example, the native resolution for both a 17" 4:3 monitor and a 19" 4:3 monitor are typically 1280x1024 which means the pixels are physically larger on the 19" monitor.  Therefore the actual physical resolution of the monitors are 84.2 x 89.9 for the 19" and 94.1 x 100.4 for the 17".

There are two ways you can work around this issue (in order of recommendation):

Adjust the X and Y scale factors of the viewer to match the proper display.  For this, you will need to set UseDpi to false and then do something like this:

double dAspectDiagonal, dAspectWidth, dAspectHeight,
    dPhysicalDiagonal, dPhysicalWidth, dPhysicalHeight,
    dPhysicalXRes, dPhysicalYRes;

dPhysicalDiagonal = 23;
dAspectWidth = 16;
dAspectHeight = 9;

dAspectDiagonal = Math.Sqrt(Math.Pow(dAspectWidth, 2) + Math.Pow(dAspectHeight, 2));

dPhysicalHeight = (dAspectHeight / dAspectDiagonal) * dPhysicalDiagonal;
dPhysicalWidth = (dAspectWidth / dAspectDiagonal) * dPhysicalDiagonal;

dPhysicalXRes = Screen.PrimaryScreen.Bounds.Width / dPhysicalWidth;
dPhysicalYRes = Screen.PrimaryScreen.Bounds.Height / dPhysicalHeight;

rasterImageViewer1.CurrentXScaleFactor = dPhysicalXRes / rasterImageViewer1.Image.XResolution;
rasterImageViewer1.CurrentYScaleFactor = dPhysicalYRes / rasterImageViewer1.Image.YResolution;

This is a relatively new feature, so you will need to make sure you are using at least Leadtools.Winforms.dll or  If you do not have these builds, please contact support@leadtools.com in order to get the download instructions for the latest patch.  For verification purposes, I need you to include the following information:

- The company you work for
- The LEADTOOLS serial number(s) you own (if you are evaluating, just say so)
- The name(s) of the developer(s) using the serial number
- A link to this forum post

If you want to set UseDpi to true, you can at least get the horizontal dimension correct by using Windows' advanced display settings to calibrate your monitor as shown in the screenshot attached screenshot.
GregR attached the following image(s):

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.

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-2022, Yet Another Forum.NET
This page was generated in 0.145 seconds.