ConvertToHorizontalPixels

View as Markdown

Definition

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

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

Method Return Value

An int representing an x-coordinate value in terms of device pixels.

Syntax

ChartingExtensions.ConvertToHorizontalPixels(this double x, PresentationSource target)

\<double\>.ConvertToHorizontalPixels(PresentationSource target)

Parameters

ParameterDescription
xThe horizontal double coordinates in application pixels to convert
targetThe PresenationSource representing the display surface used for the conversion.

Note: For Charts, see ChartControl.PresentationSource.

Examples

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