网上有 C#和CLR使用ZedGraph的例子,使用MFC操作会有变化。
http://blog.csdn.net/tjvictor/article/details/1412540参照这个例子本人将其改为MFC的代码。
m_ChartCtrl在上一篇中定义好的……
GraphPane ^myPane = m_ChartCtrl->GraphPane;
myPane->Title->Text = "My Initial Graph Sample Demo\n(For CodeProject Sample)";
myPane->XAxis->Title->Text = "My X Axis";
myPane->YAxis->Title->Text = "My Y Axis";
PointPairList ^list1 = gcnew PointPairList();
PointPairList ^list2 = gcnew PointPairList();
for ( int i=0; i<36; i++ )
{
double x = (double) i + 5;
double y1 = 1.5 + sin((double) i * 0.2 );
double y2 = 3.0 * ( 1.5 + sin((double) i * 0.2 ) );
list1->Add( x, y1 );
list2->Add( x, y2 );
}
// Generate a red curve with diamond
// symbols, and "Porsche" in the legend
LineItem ^myCurve = myPane->AddCurve("Porsche",list1,Color::Red,SymbolType::Diamond);
// Generate a blue curve with circle
// symbols, and "Piper" in the legend
LineItem ^myCurve2 = myPane->AddCurve("Piper",list2,Color::Blue,SymbolType::Circle );
m_ChartCtrl->AxisChange();
许多操作 要使用 “^”,相当于引用(或者当指针来用),本人测试时发现,不使用“^”方式,可能出不来正确的结果!