Udostępnij za pośrednictwem


DpiHelper.CreateDeviceFromLogicalImage Method

Definition

Overloads

CreateDeviceFromLogicalImage(Icon, ImageScalingMode)

Creates and returns a new icon scaled for the device units. When displayed on the device, the scaled icon will have same size as the original icon would have when displayed at 96dpi.

CreateDeviceFromLogicalImage(Image, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

CreateDeviceFromLogicalImage(ImageList, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

CreateDeviceFromLogicalImage(Bitmap, Size, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.Bitmap strip scaled for the device units, using NearestNeighbor interpolation. When displayed on the device, the scaled image strip will have same size as the original image strip would have when displayed at 96dpi.

This should be used for converting imagelists bitmap strips instead of simply scaling the bitmap, because the resultant bitmap strip size may be different from just upscaling as bitmap N * Math.Round(width * dpiscale) != Math.Round(N * width * dpiscale) This may happen depending on the image width because dpiscale is a double not an int.

CreateDeviceFromLogicalImage(Image, Color, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

CreateDeviceFromLogicalImage(ImageList, Color, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

CreateDeviceFromLogicalImage(Bitmap, Size, Color, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.Bitmap scaled for the device units When displayed on the device, the scaled image strip will have same size as the original image strip would have when displayed at 96dpi.

This should be used for converting imagelists bitmap strips instead of simply scaling the bitmap, because the resultant bitmap strip size may be different from just upscaling as bitmap N * Math.Round(width * dpiscale) != Math.Round(N * width * dpiscale) This may happen depending on the image width because dpiscale is a double not an int.

CreateDeviceFromLogicalImage(Icon, ImageScalingMode)

Creates and returns a new icon scaled for the device units. When displayed on the device, the scaled icon will have same size as the original icon would have when displayed at 96dpi.

public System.Drawing.Icon CreateDeviceFromLogicalImage (System.Drawing.Icon logicalIcon, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Drawing.Icon * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Drawing.Icon
Public Function CreateDeviceFromLogicalImage (logicalIcon As Icon, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As Icon

Parameters

logicalIcon
Icon

The icon to scale from logical units to device units

scalingMode
ImageScalingMode

The scaling mode to use when scaling the images in the strip.

Returns

The icon.

Applies to

CreateDeviceFromLogicalImage(Image, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

public System.Drawing.Image CreateDeviceFromLogicalImage (System.Drawing.Image logicalImage, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Drawing.Image * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Drawing.Image
Public Function CreateDeviceFromLogicalImage (logicalImage As Image, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As Image

Parameters

logicalImage
Image

The image to scale from logical units to device units

scalingMode
ImageScalingMode

The scaling mode to use when scaling the image

Returns

The image.

Applies to

CreateDeviceFromLogicalImage(ImageList, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

public System.Windows.Forms.ImageList CreateDeviceFromLogicalImage (System.Windows.Forms.ImageList logicalImageList, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Windows.Forms.ImageList * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Windows.Forms.ImageList
Public Function CreateDeviceFromLogicalImage (logicalImageList As ImageList, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As ImageList

Parameters

logicalImageList
ImageList

The imagelist to scale from logical units to device units

scalingMode
ImageScalingMode

The scaling mode to use when scaling the images in the imagelist

Returns

The ImageList.

Applies to

CreateDeviceFromLogicalImage(Bitmap, Size, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.Bitmap strip scaled for the device units, using NearestNeighbor interpolation. When displayed on the device, the scaled image strip will have same size as the original image strip would have when displayed at 96dpi.

This should be used for converting imagelists bitmap strips instead of simply scaling the bitmap, because the resultant bitmap strip size may be different from just upscaling as bitmap N * Math.Round(width * dpiscale) != Math.Round(N * width * dpiscale) This may happen depending on the image width because dpiscale is a double not an int.

public System.Drawing.Bitmap CreateDeviceFromLogicalImage (System.Drawing.Bitmap logicalBitmapStrip, System.Drawing.Size logicalImageSize, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Drawing.Bitmap * System.Drawing.Size * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Drawing.Bitmap
Public Function CreateDeviceFromLogicalImage (logicalBitmapStrip As Bitmap, logicalImageSize As Size, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As Bitmap

Parameters

logicalBitmapStrip
Bitmap

The image strip to scale from logical units to device units

logicalImageSize
Size

The size in logical unit of each image in the strip

scalingMode
ImageScalingMode

The scaling mode to use when scaling the images in the strip

Returns

The bitmap.

Applies to

CreateDeviceFromLogicalImage(Image, Color, ImageScalingMode)

Creates and returns a new bitmap or metafile from the logical System.Drawing.Image scaled for the device units. When displayed on the device, the scaled image will have same size as the original image would have when displayed at 96dpi.

public System.Drawing.Image CreateDeviceFromLogicalImage (System.Drawing.Image logicalImage, System.Drawing.Color backgroundColor, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Drawing.Image * System.Drawing.Color * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Drawing.Image
Public Function CreateDeviceFromLogicalImage (logicalImage As Image, backgroundColor As Color, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As Image

Parameters

logicalImage
Image

The image to scale from logical units to device units

backgroundColor
Color

A Color value to be used for the image background. When the interpolation mode is Bilinear or Bicubic, the image's margins are interpolated with the background.

scalingMode
ImageScalingMode

The scaling mode to use when scaling the image

Returns

The ImageList.

Applies to

CreateDeviceFromLogicalImage(ImageList, Color, ImageScalingMode)

Creates and returns a new imagelist scaled for the device units When displayed on the device, the scaled imagelist will have same size as the original imagelist would have when displayed at 96dpi.

public System.Windows.Forms.ImageList CreateDeviceFromLogicalImage (System.Windows.Forms.ImageList logicalImageList, System.Drawing.Color backgroundColor, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Windows.Forms.ImageList * System.Drawing.Color * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Windows.Forms.ImageList
Public Function CreateDeviceFromLogicalImage (logicalImageList As ImageList, backgroundColor As Color, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As ImageList

Parameters

logicalImageList
ImageList

The imagelist to scale from logical units to device units

backgroundColor
Color

A Color value to be used for the image background. When the interpolation mode is Bilinear or Bicubic, the image's margins are interpolated with the background.

scalingMode
ImageScalingMode

The scaling mode to use when scaling the imagelist

Returns

The ImageList.

Applies to

CreateDeviceFromLogicalImage(Bitmap, Size, Color, ImageScalingMode)

Creates and returns a new bitmap strip from the logical System.Drawing.Bitmap scaled for the device units When displayed on the device, the scaled image strip will have same size as the original image strip would have when displayed at 96dpi.

This should be used for converting imagelists bitmap strips instead of simply scaling the bitmap, because the resultant bitmap strip size may be different from just upscaling as bitmap N * Math.Round(width * dpiscale) != Math.Round(N * width * dpiscale) This may happen depending on the image width because dpiscale is a double not an int.

public System.Drawing.Bitmap CreateDeviceFromLogicalImage (System.Drawing.Bitmap logicalBitmapStrip, System.Drawing.Size logicalImageSize, System.Drawing.Color backgroundColor, Microsoft.VisualStudio.PlatformUI.ImageScalingMode scalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default);
member this.CreateDeviceFromLogicalImage : System.Drawing.Bitmap * System.Drawing.Size * System.Drawing.Color * Microsoft.VisualStudio.PlatformUI.ImageScalingMode -> System.Drawing.Bitmap
Public Function CreateDeviceFromLogicalImage (logicalBitmapStrip As Bitmap, logicalImageSize As Size, backgroundColor As Color, Optional scalingMode As ImageScalingMode = Microsoft.VisualStudio.PlatformUI.ImageScalingMode.Default) As Bitmap

Parameters

logicalBitmapStrip
Bitmap

The image strip to scale from logical units to device units

logicalImageSize
Size

The size in logical unit of each image in the strip

backgroundColor
Color

A Color value to be used for the image background. When the interpolation mode is Bilinear or Bicubic, the image's margins are interpolated with the background.

scalingMode
ImageScalingMode

The scaling mode to use when scaling the images in the strip

Returns

The bitmap.

Applies to