WEB开发网
开发学院软件开发VC 构建仪表、图表控件的绘制框架 阅读

构建仪表、图表控件的绘制框架

 2007-03-17 21:59:17 来源:WEB开发网   
核心提示: YScaleTextCircular是环绕文字,YScaleCircular是环形刻度,构建仪表、图表控件的绘制框架(4),YScaleXY是线型刻度, 4、圆表,使文字和刻度不重叠上,且很自然,直表与刻度对应的文字针对圆表的刻度文字的种类和位置定义, 图 环绕排列文字的四种方式环绕文字与

YScaleTextCircular是环绕文字。

YScaleCircular是环形刻度。

YScaleXY是线型刻度。

4、圆表,直表与刻度对应的文字

针对圆表的刻度文字的种类和位置定义。

图 环绕排列文字的四种方式

环绕文字与环形刻度一般同时出现,这就要求环绕文字必须遵循某种规则,使文字和刻度不重叠上,且很自然。

以下两图展示了这种规则的定义。

“向下”文字位置的定义

图 "向心"文字位置定义

YScaleTextCircular ScaletextCircular;
YTextHelper* pScaletextHelper = NULL;
pScaletextHelper = new YTextHelper;
pScaletextHelper->SetSize(10.f);
pScaletextHelper->FontColor.SetColor(128,128,128);
ScaletextCircular.AddText(pScaletextHelper);
pScaletextHelper = new YTextHelper;
pScaletextHelper->SetBold(TRUE);
pScaletextHelper->SetSize(12.f);
pScaletextHelper->SetFontName("黑体");
pScaletextHelper->FontColor.SetColor(255,44,44);
ScaletextCircular.AddText(pScaletextHelper);
pScaletextHelper = new YTextHelper;
pScaletextHelper->FontColor.SetColor(51,51,255);
ScaletextCircular.AddText(pScaletextHelper);
ScaletextCircular.SetType(1);
ScaletextCircular.AddText("你");
ScaletextCircular.AddText("有没有");
ScaletextCircular.AddText("想过");
ScaletextCircular.AddText("罐头");
ScaletextCircular.AddText("的");
ScaletextCircular.AddText("感受");
ScaletextCircular.AddText("?");
ScaletextCircular.SetDefault(FALSE);
ScaletextCircular.SetOrigin(point_this.X,point_this.Y);
ScaletextCircular.SetRadius((int)(cs_this.Width*0.3f));
ScaletextCircular.SetPlacement(Inside);
ScaletextCircular.Draw(g);
pScaletextHelper = NULL;
绘制线型文字

水平文字

//     ∧
//     │
// Outside │ Inside
//     │
//     │ Inside
//     └───────>
//        Outside
//
YScaleTextXY m_ScaleText;
YTextHelper* pScaletext_helper = NULL;
pScaletext_helper = new YTextHelper;
pScaletext_helper->SetSize(8.5f);
pScaletext_helper->SetAngle(-30);
pScaletext_helper->SetHorizontal(StringAlignmentFar);
m_ScaleText.AddText(pScaletext_helper);
m_ScaleText.SetMin(0);
m_ScaleText.SetMax(600);
m_ScaleText.SetBoolY(FALSE);
m_ScaleText.SetOrientation(TRUE);
m_ScaleText.SetOrigin(30.f,50.f);
m_ScaleText.SetLength(380.f);
m_ScaleText.Draw(g);
m_ScaleText.AddText("一月");
m_ScaleText.AddText("二月");
m_ScaleText.AddText("三月");
m_ScaleText.AddText("四月");
m_ScaleText.AddText("五月");
m_ScaleText.AddText("六月");
m_ScaleText.AddText("七月");
m_ScaleText.SetDefault(FALSE);
m_ScaleText.SetOrigin(30.f,80.f);
m_ScaleText.Draw(g);
pScaletext_helper = NULL;

上一页  1 2 3 4 

Tags:构建 仪表 图表

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接