本文整理汇总了C#中ZedGraph.PaneBase.CalcClientRect方法的典型用法代码示例。如果您正苦于以下问题:C# PaneBase.CalcClientRect方法的具体用法?C# PaneBase.CalcClientRect怎么用?C# PaneBase.CalcClientRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.PaneBase
的用法示例。
在下文中一共展示了PaneBase.CalcClientRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcRect
/// <summary>
/// Calculate the <see cref="Legend"/> rectangle (<see cref="Rect"/>),
/// taking into account the number of required legend
/// entries, and the legend drawing preferences.
/// </summary>
/// <remarks>Adjust the size of the
/// <see cref="Chart.Rect"/> for the parent <see cref="GraphPane"/> to accomodate the
/// space required by the legend.
/// </remarks>
/// <param name="g">
/// A graphic device object to be drawn into. This is normally e.Graphics from the
/// PaintEventArgs argument to the Paint() method.
/// </param>
/// <param name="pane">
/// A reference to the <see cref="PaneBase"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="scaleFactor">
/// The scaling factor to be used for rendering objects. This is calculated and
/// passed down by the parent <see cref="GraphPane"/> object using the
/// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
/// font sizes, etc. according to the actual size of the graph.
/// </param>
/// <param name="tChartRect">
/// The rectangle that contains the area bounded by the axes, in pixel units.
/// <seealso cref="Chart.Rect" />
/// </param>
public void CalcRect( Graphics g, PaneBase pane, float scaleFactor,
ref RectangleF tChartRect )
{
// Start with an empty rectangle
_rect = Rectangle.Empty;
_hStack = 1;
_legendItemWidth = 1;
_legendItemHeight = 0;
RectangleF clientRect = pane.CalcClientRect( g, scaleFactor );
// If the legend is invisible, don't do anything
if ( !_isVisible )
return;
int nCurve = 0;
PaneList paneList = GetPaneList( pane );
_tmpSize = GetMaxHeight( paneList, g, scaleFactor );
float halfGap = _tmpSize / 2.0F,
maxWidth = 0,
tmpWidth,
gapPix = _gap * _tmpSize;
foreach ( GraphPane tmpPane in paneList )
{
// Loop through each curve in the curve list
// Find the maximum width of the legend labels
//foreach ( CurveItem curve in tmpPane.CurveList )
//foreach ( CurveItem curve in GetIterator( tmpPane.CurveList, _isReverse ) )
int count = tmpPane.CurveList.Count;
for ( int i = 0; i < count; i++ )
{
CurveItem curve = tmpPane.CurveList[_isReverse ? count - i - 1 : i];
if ( curve._label._text != string.Empty && curve._label._isVisible )
{
// Calculate the width of the label save the max width
FontSpec tmpFont = ( curve._label._fontSpec != null ) ?
curve._label._fontSpec : this.FontSpec;
tmpWidth = tmpFont.GetWidth( g, curve._label._text, scaleFactor ) / 2;
if ( tmpWidth > maxWidth )
maxWidth = tmpWidth;
// Save the maximum symbol height for line-type curves
if ( curve is LineItem && ( (LineItem)curve ).Symbol.Size > _legendItemHeight )
_legendItemHeight = ( (LineItem)curve ).Symbol.Size;
nCurve++;
}
}
if ( pane is MasterPane && ( (MasterPane)pane ).IsUniformLegendEntries )
break;
}
float widthAvail;
// Is this legend horizontally stacked?
if ( _isHStack )
{
// Determine the available space for horizontal stacking
switch ( _position )
{
// Never stack if the legend is to the right or left
case LegendPos.Right:
case LegendPos.Left:
widthAvail = 0;
break;
//.........这里部分代码省略.........