Class Location
A class than contains information about the position of an object on the graph.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class Location : ICloneable, ISerializable
Constructors
| Improve this Doc View SourceLocation()
Default constructor for the Location class.
Declaration
public Location()
Location(Double, Double, Double, Double, CoordType, AlignH, AlignV)
Declaration
public Location(double x, double y, double width, double height, CoordType coordType, AlignH alignH, AlignV alignV)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position, specified in units of |
Double | y | The y position, specified in units of |
Double | width | The width, specified in units of |
Double | height | The height, specified in units of |
CoordType | coordType | The CoordType enum that specifies the
units for |
AlignH | alignH | The AlignH enum that specifies the horizontal alignment of the object with respect to the (x,y) location |
AlignV | alignV | The AlignV enum that specifies the vertical alignment of the object with respect to the (x,y) location |
Remarks
The (x,y) position corresponds to the starting position, the (x2, y2) coorresponds to the ending position (typically used for ArrowObj's).
Location(Double, Double, CoordType)
Declaration
public Location(double x, double y, CoordType coordType)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position, specified in units of |
Double | y | The y position, specified in units of |
CoordType | coordType | The CoordType enum that specifies the
units for |
Remarks
The (x,y) position corresponds to the top-left corner;
Location(Double, Double, CoordType, AlignH, AlignV)
Declaration
public Location(double x, double y, CoordType coordType, AlignH alignH, AlignV alignV)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position, specified in units of |
Double | y | The y position, specified in units of |
CoordType | coordType | The CoordType enum that specifies the
units for |
AlignH | alignH | The AlignH enum that specifies the horizontal alignment of the object with respect to the (x,y) location |
AlignV | alignV | The AlignV enum that specifies the vertical alignment of the object with respect to the (x,y) location |
Remarks
The (x,y) position corresponds to the top-left corner;
Location(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected Location(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
Location(Location)
The Copy Constructor
Declaration
public Location(Location rhs)
Parameters
Type | Name | Description |
---|---|---|
Location | rhs | The Location object from which to copy |
Fields
| Improve this Doc View Sourceschema
Current schema value that defines the version of the serialized file
Declaration
public const int schema = 10
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceAlignH
A horizontal alignment parameter for this object specified using the AlignH enum type.
Declaration
public AlignH AlignH { get; set; }
Property Value
Type | Description |
---|---|
AlignH |
AlignV
A vertical alignment parameter for this object specified using the AlignV enum type.
Declaration
public AlignV AlignV { get; set; }
Property Value
Type | Description |
---|---|
AlignV |
BottomRight
Declaration
public PointF BottomRight { get; }
Property Value
Type | Description |
---|---|
PointF | A PointF in CoordinateFrame units. |
Remarks
Note that this method reduces the precision of the location coordinates from double precision to single precision. In some cases, such as Date, it may affect the resolution of the point location.
CoordinateFrame
The coordinate system to be used for defining the object position
Declaration
public CoordType CoordinateFrame { get; set; }
Property Value
Type | Description |
---|---|
CoordType | The coordinate system is defined with the CoordType enum |
Height
The height of the object.
Declaration
public double Height { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property.
Rect
The RectangleF for this object as defined by the X, Y, Width, and Height properties.
Declaration
public RectangleF Rect { get; set; }
Property Value
Type | Description |
---|---|
RectangleF | A RectangleF in CoordinateFrame units. |
Remarks
Note that this method reduces the precision of the location coordinates from double precision to single precision. In some cases, such as Date, it may affect the resolution of the point location.
TopLeft
Declaration
public PointF TopLeft { get; set; }
Property Value
Type | Description |
---|---|
PointF | A PointF in CoordinateFrame units. |
Remarks
Note that this method reduces the precision of the location coordinates from double precision to single precision. In some cases, such as Date, it may affect the resolution of the point location.
Width
The width of the object.
Declaration
public double Width { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property.
X
The x position of the object.
Declaration
public double X { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignH property.
X1
The x1 position of the object (an alias for the x position).
Declaration
public double X1 { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignH property.
X2
The x2 position of the object.
Declaration
public double X2 { get; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignH property. This position is only used for objects such as ArrowObj, where it makes sense to have a second coordinate. Note that the X2 position is stored internally as a Width offset from X.
Y
The y position of the object.
Declaration
public double Y { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignV property.
Y1
The y1 position of the object (an alias for the y position).
Declaration
public double Y1 { get; set; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignV property.
Y2
The y2 position of the object.
Declaration
public double Y2 { get; }
Property Value
Type | Description |
---|---|
Double |
Remarks
The units of this position are specified by the CoordinateFrame property. The object will be aligned to this position based on the AlignV property. This position is only used for objects such as ArrowObj, where it makes sense to have a second coordinate. Note that the Y2 position is stored internally as a Height offset from Y.
Methods
| Improve this Doc View SourceClone()
Typesafe, deep-copy clone method.
Declaration
public Location Clone()
Returns
Type | Description |
---|---|
Location | A new, independent copy of this class |
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo instance with the data needed to serialize the target object
Declaration
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
Transform(PaneBase)
Transform this Location object to display device coordinates using the properties of the specified GraphPane.
Declaration
public PointF Transform(PaneBase pane)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane | A reference to the PaneBase object that contains the Axis classes which will be used for the transform. |
Returns
Type | Description |
---|---|
PointF | A point in display device coordinates that corresponds to the specified user point. |
Transform(PaneBase, Double, Double, CoordType)
Transform a data point from the specified coordinate type (CoordType) to display device coordinates (pixels).
Declaration
public static PointF Transform(PaneBase pane, double x, double y, CoordType coord)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane | A reference to the PaneBase object that contains the Axis classes which will be used for the transform. |
Double | x | The x coordinate that defines the point in user space. |
Double | y | The y coordinate that defines the point in user space. |
CoordType | coord | A CoordType type that defines the coordinate system in which the X,Y pair is defined. |
Returns
Type | Description |
---|---|
PointF | A point in display device coordinates that corresponds to the specified user point. |
Remarks
If
TransformBottomRight(PaneBase)
Declaration
public PointF TransformBottomRight(PaneBase pane)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane |
Returns
Type | Description |
---|---|
PointF | A PointF in pixel units. |
Remarks
This method transforms the location to output device pixel units. The AlignH and AlignV properties are ignored for this transformation (see TransformTopLeft(PaneBase, Single, Single)).
TransformRect(PaneBase)
Transform the RectangleF for this object as defined by the X, Y, Width, and Height properties.
Declaration
public RectangleF TransformRect(PaneBase pane)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane |
Returns
Type | Description |
---|---|
RectangleF | A RectangleF in pixel units. |
Remarks
This method transforms the location to output device pixel units. The AlignH and AlignV properties are honored in this transformation.
TransformTopLeft(PaneBase)
Declaration
public PointF TransformTopLeft(PaneBase pane)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane |
Returns
Type | Description |
---|---|
PointF | A PointF in pixel units. |
Remarks
This method transforms the location to output device pixel units. The AlignH and AlignV properties are ignored for this transformation (see TransformTopLeft(PaneBase, Single, Single)).
TransformTopLeft(PaneBase, Single, Single)
Transform this Location from the coordinate system as specified by CoordinateFrame to the device coordinates of the specified PaneBase object.
Declaration
public PointF TransformTopLeft(PaneBase pane, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane | A reference to the PaneBase object that contains the Axis classes which will be used for the transform. |
Single | width | The width of the object in device pixels |
Single | height | The height of the object in device pixels |
Returns
Type | Description |
---|---|
PointF | The top-left corner of the object |
Remarks
The returned PointF struct represents the top-left corner of the object that honors the Location properties. The AlignH and AlignV properties are honored in this transformation.
Explicit Interface Implementations
| Improve this Doc View SourceICloneable.Clone()
Implement the ICloneable interface in a typesafe manner by just calling the typed version of Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
Object | A deep copy of this object |