ElementPosition 类
定义
表示图表的许多可视元素(如图例、标题和图表区域)的基类。Represents the base class for many visual elements of the chart such as the legend, title, and chart areas. 定义图表元素在相对坐标中的位置,范围从 (0,0) 到 (100,100)。Defines the position of the chart element in relative coordinates, which range from (0,0) to (100,100).
public ref class ElementPosition : System::Windows::Forms::DataVisualization::Charting::ChartElement
public class ElementPosition : System.Windows.Forms.DataVisualization.Charting.ChartElement
type ElementPosition = class
inherit ChartElement
Public Class ElementPosition
Inherits ChartElement
- 继承
注解
ElementPosition类用于定义图表元素的位置,并使用 X 、 Y Width 和属性表示一个矩形 Height 。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.
ElementPosition类始终公开为 Position 属性,如 Position 、 Position 等。The ElementPosition class is always exposed as a Position property, such as Position, Position, and so forth. 它还在 PrePaint 控件的和 PostPaint 事件中 Chart 作为对象的属性公开 ChartPaintEventArgs 。It is also exposed in the PrePaint and PostPaint events of the Chart control as a property of the ChartPaintEventArgs object.
可以通过将属性设置为来自动设置相应图表元素的位置 Auto ; 在设计 true 视图中,还可以在设计时定位图表元素。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.
此类和结构之间有两个主要差异 RectangleF :There are two major differences between this class and a RectangleF structure:
此类可使用自动定位。This class can use automatic positioning.
此类只使用介于0到100之间的坐标,否则会引发异常。This class only uses coordinates ranging from 0 to 100, otherwise an exception is thrown.
使用相对坐标来描述图表元素的位置,其中,元素的左上角的坐标为 (0,0) ,而元素的右下角具有 (100100) 的坐标。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.
构造函数
| ElementPosition() |
初始化 ElementPosition 类的新实例。Initializes a new instance of the ElementPosition class. |
| ElementPosition(Single, Single, Single, Single) |
用指定的 |
属性
| Auto |
获取或设置一个值,该值指示 Chart 控件是否自动定位适用图表元素。Gets or sets a value that indicates whether an applicable chart element will be positioned automatically by the Chart control. |
| Bottom |
获取图表元素在相对坐标中的底部位置。Gets the bottom position of a chart element, in relative coordinates. |
| Height |
获取或设置图表元素的高度。Gets or sets the height of a chart element. |
| Right |
获取图表元素的右侧在相对坐标中的位置。Gets the position of the right side of a chart element, in relative coordinates. |
| Size |
获取图表元素的大小。Gets the size of a chart element. |
| Tag |
获取或设置与此图表元素关联的对象。Gets or sets an object associated with this chart element. (继承自 ChartElement) |
| Width |
获取或设置图表元素的宽度。Gets or sets the width of a chart element. |
| X |
获取或设置适用图表元素左上角的相对 X 坐标。Gets or sets the relative X-coordinate of the top-left corner of an applicable chart element. |
| Y |
获取或设置适用图表元素左上角的相对 Y 坐标。Gets or sets the relative Y-coordinate of the top-left corner of an applicable chart element. |
方法
| Dispose() |
释放由 ChartElement 占用的资源。Releases the resources used by the ChartElement. (继承自 ChartElement) |
| Dispose(Boolean) |
释放由 ChartElement 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the ChartElement and optionally releases the managed resources. (继承自 ChartElement) |
| Equals(Object) |
确定指定的 Object 是否等于当前 ChartElement。Determines whether the specified Object is equal to the current ChartElement. (继承自 ChartElement) |
| FromRectangleF(RectangleF) |
通过 ElementPosition 结构初始化 RectangleF 对象。Initializes an ElementPosition object from a RectangleF structure. |
| GetHashCode() |
返回特定类型的哈希算法。Returns a hash function for a particular type. (继承自 ChartElement) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToRectangleF() |
返回一个 RectangleF 对象,该对象使用 ElementPosition 对象的坐标。Returns a RectangleF object that uses the coordinates of an ElementPosition object. |
| ToString() |
返回表示当前 Object 的字符串。Returns a string that represents the current Object. (继承自 ChartElement) |