ConvertFromHorizontalPixels

View as Markdown

Definition

Converts an x-axis pixel coordinate from device pixels to application pixels.

For more information concerning the differences between application pixels and device pixels, please see the Working with Pixel Coordinates.

Method Return Value

A double representing an x-coordinate value in terms of application pixels.

Syntax

ChartingExtensions.ConvertFromHorizontalPixels(this int x, PresentationSource target)

int.ConvertFromHorizontalPixels(PresentationSource target)

Parameters

ParameterDescription
xThe horizontal int coordinates in device pixels to convert.
targetThe PresentationSource representing the display surface used for the conversion. Note: For Charts, see ChartControl.PresentationSource.

Examples

1int applicationPixelX;
2
3protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
4{
5 // Obtain the application-pixel coordinate corresponding to a device-pixel X value of 500
6 applicationPixelX = ChartingExtensions.ConvertFromHorizontalPixels(500, ChartControl.PresentationSource);
7}