Export (0) Print
Expand All

ElementPosition Class

Represents the base class for many visual elements of the chart such as the legend, title, and chart areas. Defines the position of the chart element in relative coordinates, which range from (0,0) to (100,100).

System.Object
  System.Windows.Forms.DataVisualization.Charting.ChartElement
    System.Windows.Forms.DataVisualization.Charting.ElementPosition

Namespace:  System.Windows.Forms.DataVisualization.Charting
Assembly:  System.Windows.Forms.DataVisualization (in System.Windows.Forms.DataVisualization.dll)

public class ElementPosition : ChartElement

The ElementPosition type exposes the following members.

  NameDescription
Public methodElementPosition()Initializes a new instance of the ElementPosition class.
Public methodElementPosition(Single, Single, Single, Single)Initializes a new instance of the ElementPosition class with the specified x, y, width and height parameters.
Top

  NameDescription
Public propertyAutoGets or sets a value that indicates whether an applicable chart element will be positioned automatically by the Chart control.
Public propertyBottomGets the bottom position of a chart element, in relative coordinates.
Public propertyHeightGets or sets the height of a chart element.
Public propertyRightGets the position of the right side of a chart element, in relative coordinates.
Public propertySizeGets the size of a chart element.
Public propertyTagGets or sets an object associated with this chart element. (Inherited from ChartElement.)
Public propertyWidthGets or sets the width of a chart element.
Public propertyXGets or sets the relative X-coordinate of the top-left corner of an applicable chart element.
Public propertyYGets or sets the relative Y-coordinate of the top-left corner of an applicable chart element.
Top

  NameDescription
Public methodDispose()Releases the resources used by the ChartElement. (Inherited from ChartElement.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the ChartElement and optionally releases the managed resources. (Inherited from ChartElement.)
Public methodEqualsDetermines whether the specified Object is equal to the current ChartElement. (Inherited from ChartElement.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFromRectangleFInitializes an ElementPosition object from a RectangleF structure.
Public methodGetHashCodeReturns a hash function for a particular type. (Inherited from ChartElement.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToRectangleFReturns a RectangleF object that uses the coordinates of an ElementPosition object.
Public methodToStringReturns a string that represents the current Object. (Inherited from ChartElement.)
Top

The ElementPosition class is used to define the position of a chart element, and represents one rectangle using the X, Y, Width and Height properties.

The ElementPosition class is always exposed as a Position property, such as Position, Position, and so forth. It is also exposed in the PrePaint and PostPaint events of the Chart control as a property of the ChartPaintEventArgs object.

The position of the applicable chart elements can be set automatically by setting the Auto property to true; chart elements can also be positioned at design time in the Design View.

There are two major differences between this class and a RectangleF structure:

  • This class can use automatic positioning.

  • This class only uses coordinates ranging from 0 to 100, otherwise an exception is thrown.

The position of chart elements is described using relative coordinates, with the top-left corner of an element having coordinates of (0,0) and the bottom-right corner of an element having coordinates of (100,100).

Elements that are plotted within a chart area use coordinates that are relative to the chart area, whereas elements outside a chart area use coordinates that are relative to the chart image.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft