Class PaneBase
An abstract base class that defines basic functionality for handling a pane. This class is the parent class for MasterPane and GraphPane.
Implements
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
public abstract class PaneBase : ICloneable
Constructors
| Improve this Doc View SourcePaneBase()
Declaration
public PaneBase()
PaneBase(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected PaneBase(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 |
PaneBase(String, RectangleF)
Default constructor for the PaneBase class. Specifies the Title of the PaneBase, and the size of the Rect.
Declaration
public PaneBase(string title, RectangleF paneRect)
Parameters
Type | Name | Description |
---|---|---|
String | title | |
RectangleF | paneRect |
PaneBase(PaneBase)
The Copy Constructor
Declaration
public PaneBase(PaneBase rhs)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | rhs | The PaneBase object from which to copy |
Fields
| Improve this Doc View Source_baseDimension
Private field that determines the base size of the pane, in inches. Fonts, tics, gaps, etc. are scaled according to this base size. Use the public property BaseDimension to access this value.
Declaration
[CLSCompliant(false)]
protected float _baseDimension
Field Value
Type | Description |
---|---|
Single |
See Also
| Improve this Doc View Source_border
Private field that stores the Border data for the Rect border. Use the public property Border to access this value.
Declaration
[CLSCompliant(false)]
protected Border _border
Field Value
Type | Description |
---|---|
Border |
_fill
Private field that stores the Fill data for the Rect background. Use the public property Fill to access this value.
Declaration
[CLSCompliant(false)]
protected Fill _fill
Field Value
Type | Description |
---|---|
Fill |
_graphObjList
Private field instance of the GraphObjList class. Use the public property GraphObjList to access this class.
Declaration
[CLSCompliant(false)]
protected GraphObjList _graphObjList
Field Value
Type | Description |
---|---|
GraphObjList |
_isFontsScaled
Private field that determines whether or not the fonts, tics, gaps, etc. will be scaled according to the actual graph size. true for font and feature scaling with graph size, false for fixed font sizes (scaleFactor = 1.0 constant). Use the public property IsFontsScaled to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isFontsScaled
Field Value
Type | Description |
---|---|
Boolean |
See Also
| Improve this Doc View Source_isPenWidthScaled
Private field that controls whether or not pen widths are scaled according to the size of the graph. This value is only applicable if IsFontsScaled is true. If IsFontsScaled is false, then no scaling will be done, regardless of the value of IsPenWidthScaled.
Declaration
[CLSCompliant(false)]
protected bool _isPenWidthScaled
Field Value
Type | Description |
---|---|
Boolean | true to scale the pen widths according to the size of the graph, false otherwise. |
See Also
| Improve this Doc View Source_legend
Declaration
[CLSCompliant(false)]
protected Legend _legend
Field Value
Type | Description |
---|---|
Legend |
_rect
The rectangle that defines the full area into which the pane is rendered. Units are pixels. Use the public property Rect to access this value.
Declaration
[CLSCompliant(false)]
protected RectangleF _rect
Field Value
Type | Description |
---|---|
RectangleF |
_tag
Private field that stores the user-defined tag for this PaneBase. This tag can be any user-defined value. If it is a String type, it can be used as a parameter to the IndexOfTag(String) method. Use the public property Tag to access this value.
Declaration
[CLSCompliant(false)]
protected object _tag
Field Value
Type | Description |
---|---|
Object |
_title
Private field that holds the main title of the pane. Use the public property Title to access this value.
Declaration
[CLSCompliant(false)]
protected GapLabel _title
Field Value
Type | Description |
---|---|
GapLabel |
_titleGap
private field that stores the gap between the bottom of the pane title and the client area of the pane. This is expressed as a fraction of the title character height.
Declaration
[CLSCompliant(false)]
protected float _titleGap
Field Value
Type | Description |
---|---|
Single |
schema
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 SourceBaseDimension
BaseDimension is a double precision value that sets "normal" pane size on which all the settings are based. The BaseDimension is in inches. For example, if the BaseDimension is 8.0 inches and the Title size is 14 points. Then the pane title font will be 14 points high when the Rect is approximately 8.0 inches wide. If the Rect is 4.0 inches wide, the pane title font will be 7 points high. Most features of the graph are scaled in this manner.
Declaration
public float BaseDimension { get; set; }
Property Value
Type | Description |
---|---|
Single | The base dimension reference for the Rect, in inches |
See Also
| Improve this Doc View SourceBorder
Declaration
public Border Border { get; set; }
Property Value
Type | Description |
---|---|
Border |
See Also
| Improve this Doc View SourceFill
Declaration
public Fill Fill { get; set; }
Property Value
Type | Description |
---|---|
Fill |
GraphObjList
Declaration
public GraphObjList GraphObjList { get; set; }
Property Value
Type | Description |
---|---|
GraphObjList | A reference to a GraphObjList collection object |
IsFontsScaled
Determines if the font sizes, tic sizes, gap sizes, etc. will be scaled according to the size of the Rect and the BaseDimension. If this value is set to false, then the font sizes and tic sizes will always be exactly as specified, without any scaling.
Declaration
public bool IsFontsScaled { get; set; }
Property Value
Type | Description |
---|---|
Boolean | True to have the fonts and tics scaled, false to have them constant |
See Also
| Improve this Doc View SourceIsPenWidthScaled
Gets or sets the property that controls whether or not pen widths are scaled for this PaneBase.
Declaration
public bool IsPenWidthScaled { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to scale the pen widths according to the size of the graph, false otherwise. |
Remarks
This value is only applicable if IsFontsScaled is true. If IsFontsScaled is false, then no scaling will be done, regardless of the value of IsPenWidthScaled. Note that scaling the pen widths can cause "artifacts" to appear at typical screen resolutions. This occurs because of roundoff differences; in some cases the pen width may round to 1 pixel wide and in another it may round to 2 pixels wide. The result is typically undesirable. Therefore, this option defaults to false. This option is primarily useful for high resolution output, such as printer output or high resolution bitmaps (from GetImage(Int32, Int32, Single)) where it is desirable to have the pen width be consistent with the screen image.
See Also
| Improve this Doc View SourceLegend
Declaration
public Legend Legend { get; }
Property Value
Type | Description |
---|---|
Legend | A reference to a Legend object |
Margin
Gets or sets the Margin instance that controls the space between the edge of the Rect and the rendered content of the graph.
Declaration
public Margin Margin { get; set; }
Property Value
Type | Description |
---|---|
Margin |
Rect
The rectangle that defines the full area into which all graphics will be rendered.
Declaration
public RectangleF Rect { get; set; }
Property Value
Type | Description |
---|---|
RectangleF | Units are pixels. |
Remarks
Note that this rectangle has x, y, width, and height. Most of the GDI+ graphic primitive actually draw one pixel beyond those dimensions. For example, for a rectangle of ( X=0, Y=0, Width=100, Height=100 ), GDI+ would draw into pixels 0 through 100, which is actually 101 pixels. For the ZedGraph Rect, a Width of 100 pixels means that pixels 0 through 99 are used
See Also
| Improve this Doc View SourceTag
Gets or sets the user-defined tag for this PaneBase. This tag can be any user-defined value. If it is a String type, it can be used as a parameter to the IndexOfTag(String) method.
Declaration
public object Tag { get; set; }
Property Value
Type | Description |
---|---|
Object |
Remarks
Note that, if you are going to Serialize ZedGraph data, then any type that you store in Tag must be a serializable type (or it will cause an exception).
Title
Gets the Label instance that contains the text and attributes of the title. This text can be multiple lines separated by newline characters ('\n').
Declaration
public Label Title { get; }
Property Value
Type | Description |
---|---|
Label |
See Also
| Improve this Doc View SourceTitleGap
Gets or sets the gap between the bottom of the pane title and the client area of the pane. This is expressed as a fraction of the scaled Title character height.
Declaration
public float TitleGap { get; set; }
Property Value
Type | Description |
---|---|
Single |
Methods
| Improve this Doc View SourceCalcClientRect(Graphics, Single)
Calculate the client area rectangle based on the Rect.
Declaration
public RectangleF CalcClientRect(Graphics g, 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. |
Single | scaleFactor | The scaling factor for the features of the graph based on the BaseDimension. This scaling factor is calculated by the CalcScaleFactor() method. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, etc. |
Returns
Type | Description |
---|---|
RectangleF | The calculated chart rect, in pixel coordinates. |
Remarks
The client rectangle is the actual area available for GraphPane or MasterPane items after taking out space for the margins and the title. This method does not take out the area required for the Legend. To do so, you must separately call CalcRect(Graphics, PaneBase, Single, ref RectangleF).
CalcScaleFactor()
Calculate the scaling factor based on the ratio of the current Rect dimensions and the BaseDimension.
Declaration
public float CalcScaleFactor()
Returns
Type | Description |
---|---|
Single | A Single value representing the scaling factor to use for the rendering calculations. |
Remarks
This scaling factor is used to proportionally scale the features of the MasterPane so that small graphs don't have huge fonts, and vice versa. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, tic sizes, gap sizes, pen widths, etc. The units of the scale factor are "World Pixels" per "Standard Point". If any object size, in points, is multiplied by this scale factor, the result is the size, in pixels, that the object should be drawn using the standard GDI+ drawing instructions. A "Standard Point" is a dimension based on points (1/72nd inch) assuming that the Rect size matches the BaseDimension. Note that "World Pixels" will still be transformed by the GDI+ transform matrices to result in "Output Device Pixels", but "World Pixels" are the reference basis for the drawing commands.
See Also
| Improve this Doc View SourceDraw(Graphics)
Do all rendering associated with this PaneBase to the specified Graphics device. This abstract method is implemented by the child classes.
Declaration
public virtual void Draw(Graphics g)
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. |
DrawPaneFrame(Graphics, Single)
Draw the border _border around the Rect area.
Declaration
public void DrawPaneFrame(Graphics g, 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. |
Single | scaleFactor | The scaling factor for the features of the graph based on the BaseDimension. This scaling factor is calculated by the CalcScaleFactor() method. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, etc. |
DrawTitle(Graphics, Single)
Draw the Title on the graph, centered at the top of the pane.
Declaration
public void DrawTitle(Graphics g, 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. |
Single | scaleFactor | The scaling factor for the features of the graph based on the BaseDimension. This scaling factor is calculated by the CalcScaleFactor() method. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, etc. |
GetImage()
Declaration
public Bitmap GetImage()
Returns
Type | Description |
---|---|
Bitmap | A Bitmap object rendered with the current graph. |
See Also
| Improve this Doc View SourceGetImage(Boolean)
Declaration
public Bitmap GetImage(bool isAntiAlias)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isAntiAlias |
Returns
Type | Description |
---|---|
Bitmap | A Bitmap object rendered with the current graph. |
See Also
| Improve this Doc View SourceGetImage(Int32, Int32, Single)
Gets an image for the current GraphPane, scaled to the specified size and resolution.
Declaration
public Bitmap GetImage(int width, int height, float dpi)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The scaled width of the bitmap in pixels |
Int32 | height | The scaled height of the bitmap in pixels |
Single | dpi | The resolution of the bitmap, in dots per inch |
Returns
Type | Description |
---|---|
Bitmap |
See Also
| Improve this Doc View SourceGetImage(Int32, Int32, Single, Boolean)
Gets an image for the current GraphPane, scaled to the specified size and resolution.
Declaration
public Bitmap GetImage(int width, int height, float dpi, bool isAntiAlias)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The scaled width of the bitmap in pixels |
Int32 | height | The scaled height of the bitmap in pixels |
Single | dpi | The resolution of the bitmap, in dots per inch |
Boolean | isAntiAlias | true for anti-aliased rendering, false otherwise |
Returns
Type | Description |
---|---|
Bitmap |
See Also
| Improve this Doc View SourceGetMetafile()
Gets an enhanced metafile image for the current GraphPane.
Declaration
public Metafile GetMetafile()
Returns
Type | Description |
---|---|
Metafile |
See Also
| Improve this Doc View SourceGetMetafile(Int32, Int32)
Gets an enhanced metafile image for the current GraphPane, scaled to the specified size.
Declaration
public Metafile GetMetafile(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The "effective" scaled width of the bitmap in pixels |
Int32 | height | The "effective" scaled height of the bitmap in pixels |
Returns
Type | Description |
---|---|
Metafile |
Remarks
By definition, a Metafile is a vector drawing, and therefore scaling should not matter. However, this method is provided because certain options in Zedgraph, such as IsFontsScaled are affected by the size of the expected image.
See Also
| Improve this Doc View SourceGetMetafile(Int32, Int32, Boolean)
Gets an enhanced metafile image for the current GraphPane, scaled to the specified size.
Declaration
public Metafile GetMetafile(int width, int height, bool isAntiAlias)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The "effective" scaled width of the bitmap in pixels |
Int32 | height | The "effective" scaled height of the bitmap in pixels |
Boolean | isAntiAlias | true to use anti-aliased drawing mode, false otherwise |
Returns
Type | Description |
---|---|
Metafile |
Remarks
By definition, a Metafile is a vector drawing, and therefore scaling should not matter. However, this method is provided because certain options in Zedgraph, such as IsFontsScaled are affected by the size of the expected image.
See Also
| 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 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 |
ReSize(Graphics, RectangleF)
Change the size of the Rect. Override this method to handle resizing the contents as required.
Declaration
public virtual void ReSize(Graphics g, RectangleF rect)
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. |
RectangleF | rect | The new size for the Rect. |
ScaledPenWidth(Single, Single)
Calculate the scaled pen width, taking into account the scaleFactor and the setting of the IsPenWidthScaled property of the pane.
Declaration
public float ScaledPenWidth(float penWidth, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Single | penWidth | The pen width, in points (1/72 inch) |
Single | scaleFactor | The scaling factor for the features of the graph based on the BaseDimension. This scaling factor is calculated by the CalcScaleFactor() method. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, etc. |
Returns
Type | Description |
---|---|
Single | The scaled pen width, in world pixels |
ShallowClone()
Create a shallow, memberwise copy of this class.
Declaration
public PaneBase ShallowClone()
Returns
Type | Description |
---|---|
PaneBase | a new copy of the class |
Remarks
Note that this method uses MemberWiseClone, which will copy all members (shallow) including those of classes derived from this class.
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 |
Remarks
Note that this method must be called with an explicit cast to ICloneable, and that it is inherently virtual. For example:
ParentClass foo = new ChildClass();
ChildClass bar = (ChildClass) ((ICloneable)foo).Clone();
Assume that ChildClass is inherited from ParentClass. Even though foo is declared with ParentClass, it is actually an instance of ChildClass. Calling the ICloneable implementation of Clone() on foo actually calls ChildClass.Clone() as if it were a virtual function.