利用ProEssentials OCX画图

来源:互联网 发布:输入法设置软件 编辑:程序博客网 时间:2024/06/06 03:53

假定已经安装好ProEssentialsPe下载链接.

ProEssentials 包含 5 个ActiveX 接口: Graph, Scientific Graph, 3D Scientific Graph, Pie Chart, and Polar Chart controls.

 在ProEssentials Pro

"PEGRP32E.DLL"

如下图

PE3DO32E.OCX Gigasoft Pe3do代表ProEssentiols 3D Scientific Graph Object

PEGO32E.OCX  Pego代表Graph Object

PEPCO32E.OCX Pepco代表 Pie Chart Object

PEPSO32E.OCX Pepso代表Polar Chart / Smith Chart / Admittance Chart / Rose Chart

PESGO32E.OCX  Pesgo代表Scientific Graph Object

PEGRP32E.DLL

ProEssentialsPro DLL

PEGO32E.OCXGraph Object

PESGO32E.OCXScientific Graph Object

PE3DO32E.OCX3D Scientific Graph Objec

tPEPSO32E.OCXPolar Object

PEPCO32E.OCXPie Chart Object


添加控件

放置在对话框,运行如下图所示。


上面图像即为所见. 展示了默认ProEssentials Graph状态下样式. 默认状态有一个 含有4个数据点的子集. 在构造你自己的图表过程中, 设置属性页Subsets 和Points属性 ,这两个属性定义了图表中使用数据的质量. 通过YData(subset, point) 二维属性数组传递数据. 

 

下面是传递数据代码示例. 当我们创建Scientific Graph (Pesgo), 还需设置tXData(subset, point).

ProEssentials 使用术语 Subsets 和 Points ,但你也可以把它们想象为行和列( Rows and Columns). 传递数据是如此简单,只需用相关的数据值点(Points)填充每一子集(subset).

为IDC_PEGOECTRL1添加Control类CPegoe实例m_pego1

 

在OnInitDialog()中键入下面代码。短短几行代码可以让你理解的更加透彻,并且展示了ProEssentials支持自动代码补全特色。

前两行设置t Subsets andPoints. 你一你要传递的数据数量.

 

m_pego1.SetSubsets(2);m_pego1.SetPoints(10);

接着一个嵌套的for循环 传递随机数据给 YData(s, p) 属性数组.

 

for (int i=0;i<2;s++){for (int j=0;j<10;j++){m_pego1.SetYData(i,j,rand());}}

设置主标题( MainTitle)和副标题( SubTitle) . 当副标题为空字符串时将隐藏副标题.Y轴标题( YAxisLabel )和X轴标题( XAxisLabel )相同设置.

m_pego1.SetMainTitle("主标题");m_pego1.SetSubTitle("");m_pego1.SetYAxisLabel("Y轴");m_pego1.SetXAxisLabel("");

子集标签设置第一个子集标签 Hellol. 设置第二个子集标签world.

 

m_pego1.SetSubsetLabels(0,"Hello");m_pego1.SetSubsetLabels(1,"world!");

接下来设置其他控制视觉显示的属性变量.

 

        m_pego1.SetSubsetLabels(0,"Hello");m_pego1.SetSubsetLabels(1,"world!");         m_pego1.SetBitmapGradientMode(TRUE);//m_pego1.SetQuickStyle(PEQS_LIGHT_INSET);        m_pego1.SetQuickStyle(1);m_pego1.SetFixedFonts(TRUE);        //m_pego1.SetLegendStyle(PELS_1_LINE_INSIDE_AXIS);        m_pego1.SetLegendStyle(2);//查看宏定义PELS_1_LINE_INSIDE_AXIS=2        m_pego1.SetPEactions(REINITIALIZE_RESETIMAGE);//实际编程中无此宏定义,不知道定义在哪了        return TRUE;         // return TRUE  unless you set the focus to a control

最后 PEactions设置为 REINITIALIZE_RESETIMAGE 将告诉 ProEssentials已经完成属性设置. 



This example is very simple and you'll likely set other properties such as:Width/Height so that the control uses Form1's client area as needed.

 

PointLabels which will replace the "1,2,3..." along x axis.

 

SubsetLineTypes which controls line styles.

 

SubsetColors which controls line colors.

 

PlottingMethod which controls the type of chart created, Line, Bar, Area, Point, etc.
原创粉丝点击