Create a unit from pixels and a resolution. Useful for
working with images.
Namespace: TallComponents.PDFAssembly: TallComponents.PDF.Controls.WinForms (in TallComponents.PDF.Controls.WinForms.dll) Version: 2.0.46.0
Syntax
| C# |
|---|
public static Unit FromPixels( int pixels, double dpi ) |
| Visual Basic |
|---|
Public Shared Function FromPixels ( _ pixels As Integer, _ dpi As Double _ ) As Unit |
Parameters
- pixels
- Type: System..::..Int32
Length in pixels
- dpi
- Type: System..::..Double
Resolution in dpi (Dots Per Inch)
Return Value
Remarks
Default resolution for screen display is normally 72dpi, though 96dpi is used by GDI+.
Examples
ImageShape image = new ImageShape( "image.jpg" ); image.KeepAspectRatio = true; // Calculate width at resolution of 300dpi image.Width = Unit.FromPixels( bitmap.Width, 300 );