Gets or sets a value that indicates whether LEAD's automated scaling properties are used to account for the physical resolution of the bitmap.
public virtual bool UseDpi { get; set; }
public:
virtual property bool UseDpi
{
bool get()
void set(bool value)
}
true Account for the physical resolution. Default value is true.
The physical resolution of an image is measured in dots per inch (DPI). When you load an image, the Leadtools.RasterImage.XResolution and Leadtools.RasterImage.YResolution properties are updated with the DPI values for the horizontal and vertical resolution. Some images have different horizontal and vertical resolutions. For example, the horizontal resolution of a fax image is typically twice its vertical resolution (for example 200 by 100). In such cases, the displayed images will appear elongated if you do not account for the resolution. If the values of the Leadtools.RasterImage.XResolution property and the Leadtools.RasterImage.YResolution property are not equal, set the UseDpi property to true to have LEAD's automated scaling properties account for the physical resolution of the image.
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Drawing;
public void RasterPictureBox_RasterPictureBox()
{
MyForm1 form = new MyForm1();
form.ShowDialog();
}
class MyForm1 : Form
{
RasterPictureBox thePictureBox;
public MyForm1()
{
// Create the raster PictureBox
thePictureBox = new RasterPictureBox();
thePictureBox.Dock = DockStyle.Fill;
thePictureBox.BorderStyle = BorderStyle.Fixed3D;
thePictureBox.UseDpi = false;
// Set the paint properties
RasterPaintProperties p = new RasterPaintProperties();
p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic;
p.PaintEngine = RasterPaintEngine.GdiPlus;
p.UsePaintPalette = true;
thePictureBox.PaintProperties = p;
Controls.Add(thePictureBox);
thePictureBox.BringToFront();
// load an image into the viewer
RasterCodecs codecs = new RasterCodecs();
thePictureBox.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "eye.gif"));
codecs.Dispose();
Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode);
thePictureBox.DoubleClick += new EventHandler(thePictureBox_DoubleClick);
}
void thePictureBox_DoubleClick(object sender, EventArgs e)
{
switch (thePictureBox.SizeMode)
{
case RasterPictureBoxSizeMode.Normal:
thePictureBox.SizeMode = RasterPictureBoxSizeMode.StretchImage;
break;
case RasterPictureBoxSizeMode.StretchImage:
thePictureBox.SizeMode = RasterPictureBoxSizeMode.Fit;
break;
case RasterPictureBoxSizeMode.Fit:
thePictureBox.SizeMode = RasterPictureBoxSizeMode.AutoSize;
break;
case RasterPictureBoxSizeMode.AutoSize:
thePictureBox.SizeMode = RasterPictureBoxSizeMode.CenterImage;
break;
case RasterPictureBoxSizeMode.CenterImage:
thePictureBox.SizeMode = RasterPictureBoxSizeMode.Normal;
break;
}
Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode);
base.OnDoubleClick(e);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document