首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

用zedGraph画图表,请教,怎么设置图例框的高度

2011-12-18 
用zedGraph画图表,请问,如何设置图例框的高度.图例框里的文字稍微出了点边框,我想调整一下图例框的高度,让

用zedGraph画图表,请问,如何设置图例框的高度.
图例框里的文字稍微出了点边框,
我想调整一下图例框的高度,让文字完全在框内,
请问如何设置?

[解决办法]
找到解决方法了
private float GetMaxHeight( PaneList paneList, Graphics g, float scaleFactor )
{
// Set up some scaled dimensions for calculating sizes and locations
float defaultCharHeight = this.FontSpec.GetHeight( scaleFactor );
float maxCharHeight = defaultCharHeight;

// Find the largest charHeight, just in case the curves have individual fonts defined
foreach (GraphPane tmpPane in paneList )
{
foreach ( CurveItem curve in tmpPane.CurveList )
{
if ( curve._label._text != string.Empty && curve._label._isVisible )
{
float tmpHeight = defaultCharHeight;
if ( curve._label._fontSpec != null )
tmpHeight = curve._label._fontSpec.GetHeight( scaleFactor );

// Account for multiline legend entries
tmpHeight *= curve._label._text.Split( '\n' ).Length;

if ( tmpHeight > maxCharHeight )
maxCharHeight = tmpHeight;
}
}
}
//图例加5防止文字离线太近
return maxCharHeight+5;
}
legend.cs文件中

热点排行