LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)
LEAD Technologies, Inc

ScreenDpiY Property (ImageBox)






Gets or sets the current screen vertical resolution in dots/inch (or DPI). This is a dependency property. .NET support Silverlight support
Syntax
public int ScreenDpiY {get; set;}
'Declaration
 
Public Property ScreenDpiY As Integer
'Usage
 
Dim instance As ImageBox
Dim value As Integer
 
instance.ScreenDpiY = value
 
value = instance.ScreenDpiY
public int ScreenDpiY {get; set;}
 get_ScreenDpiY();
set_ScreenDpiY(value);
public:
property int ScreenDpiY {
   int get();
   void set (    int value);
}

Property Value

The current screen vertical resolution in dots/inch (or DPI). A value of 0 means use the current screen resolution which is typically 96. Default value is 0.
Remarks

The values of SourceDpiX, SourceDpiY, ScreenDpiX and ScreenDpiY are used when calculating how to display the image if the value of UseDpi is set to true.

For example, a typical A4 document image is 8.5 by 11 inches. Which could be 2550 by 3300 pixels if the image has a resolution of 300 by 300. Most document viewer applications will try to display this image in its original size. i.e. the image will take 8.5 inches of screen horizontal space and 11 inches of screen vertical space. Without using the UseDpi property of this control, you are required to do the calculations yourself as follows:

            control.UseDpi = false;
            control.ScaleFactor = screenResolution / imageResolution;
            

In the case of the image above, this will be 96 (typical screen resolution) divided by 300. Or, you can set the UseDpi value to true and the control will use the above formula internally keeping the ScaleFactor set to 1 as follows:

            control.UseDpi = true;
            control.ScaleFactor = 1;
            

This code will produce the same result as the previous one.

The control will automatically set the ScreenDpiX and ScreenDpiY to the current screen resolution, also the SourceDpiX and SourceDpiY will be obtained from the current image set in Source. You can change these values if required for manual calculations.

Note that in Silverlight, the current screen resolution cannot be obtained from the system, instead the default value of 0 will always use the fixed 96 which is the default for most screens. You should set the values of ScreenDpiX and ScreenDpiY manually if required.

Example

For XAML example, refer to ImageBox.

For C#/VB examples, refer to ImageBox.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ImageBox Class
ImageBox Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.