Class LineObj
A class that represents a line segment object on the graph. A list of GraphObj objects is maintained by the GraphObjList collection class.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class LineObj : GraphObj, ICloneable, ISerializable
Remarks
This should not be confused with the LineItem class, which represents a set of points plotted together as a "curve". The LineObj class is a single line segment, drawn as a "decoration" on the chart.
Constructors
| Improve this Doc View SourceLineObj()
Default constructor -- places the LineObj at location (0,0) to (1,1). All other values are defaulted.
Declaration
public LineObj()
LineObj(Double, Double, Double, Double)
A constructor that allows only the position of the line to be pre-specified. All other properties are set to default values
Declaration
public LineObj(double x1, double y1, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
Double | x1 | The x position of the starting point that defines the LineObj. The units of this position are specified by the CoordinateFrame property. |
Double | y1 | The y position of the starting point that defines the LineObj. The units of this position are specified by the CoordinateFrame property. |
Double | x2 | The x position of the ending point that defines the LineObj. The units of this position are specified by the CoordinateFrame property. |
Double | y2 | The y position of the ending point that defines the LineObj. The units of this position are specified by the CoordinateFrame property. |
LineObj(Color, Double, Double, Double, Double)
A constructor that allows the position, color, and size of the LineObj to be pre-specified.
Declaration
public LineObj(Color color, double x1, double y1, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
Color | color | An arbitrary Color specification for the arrow |
Double | x1 | The x position of the starting point that defines the line. The units of this position are specified by the CoordinateFrame property. |
Double | y1 | The y position of the starting point that defines the line. The units of this position are specified by the CoordinateFrame property. |
Double | x2 | The x position of the ending point that defines the line. The units of this position are specified by the CoordinateFrame property. |
Double | y2 | The y position of the ending point that defines the line. The units of this position are specified by the CoordinateFrame property. |
LineObj(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected LineObj(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 |
LineObj(LineObj)
The Copy Constructor
Declaration
public LineObj(LineObj rhs)
Parameters
Type | Name | Description |
---|---|---|
LineObj | rhs | The LineObj object from which to copy |
Fields
| Improve this Doc View Source_line
protected field that maintains the attributes of the line using an instance of the LineBase class.
Declaration
[CLSCompliant(false)]
protected LineBase _line
Field Value
Type | Description |
---|---|
LineBase |
schema2
Current schema value that defines the version of the serialized file
Declaration
public const int schema2 = 11
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceLine
Declaration
public LineBase Line { get; set; }
Property Value
Type | Description |
---|---|
LineBase |
Methods
| Improve this Doc View SourceClone()
Typesafe, deep-copy clone method.
Declaration
public LineObj Clone()
Returns
Type | Description |
---|---|
LineObj | A new, independent copy of this class |
Draw(Graphics, PaneBase, Single)
Render this object to the specified Graphics device.
Declaration
public override void Draw(Graphics g, PaneBase pane, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
PaneBase | pane | A reference to the PaneBase object that is the parent or owner of this object. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent GraphPane object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
Overrides
Remarks
This method is normally only called by the Draw method of the parent GraphObjList collection object.
GetCoords(PaneBase, Graphics, Single, out String, out String)
Determines the shape type and Coords values for this GraphObj
Declaration
public override void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane | |
Graphics | g | |
Single | scaleFactor | |
String | shape | |
String | coords |
Overrides
| Improve this Doc View SourceGetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo instance with the data needed to serialize the target object
Declaration
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override 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 |
Overrides
| Improve this Doc View SourcePointInBox(PointF, PaneBase, Graphics, Single)
Determine if the specified screen point lies inside the bounding box of this LineObj.
Declaration
public override bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
PointF | pt | The screen point, in pixels |
PaneBase | pane | A reference to the PaneBase object that is the parent or owner of this object. |
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent GraphPane object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
Returns
Type | Description |
---|---|
Boolean | true if the point lies in the bounding box, false otherwise |
Overrides
Remarks
The bounding box is calculated assuming a distance of NearestTol pixels around the arrow segment.
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 |