ConvertFromHorizontalPixels

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > Charts > ChartingExtensions >

ConvertFromHorizontalPixels

Previous page Return to chapter overview Next page

Definition

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

 

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

 

 

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

x

The horizontal int coordinates in device pixels to convert

target

The PresenationSource representing the display surface used for the conversion

 

Note:  For Charts, see ChartControl.PresentationSource

 

 

Example

ns

int applicationPixelX;

 

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