我用vfp的Foxcharts 做了一个学生人数的统计图。开始时,在开发机器上可以运行,可是不知什么时候不能运行了,一旦运行时,就出错,调用自己编的程序,遇到错误程序时就退出来。不知问题出在哪?我作了下列测试:
一、用foxpro的编译器,编译后,在A开发机器上运行正常。
二、用黄清海的压缩编译器,压缩编译后,在开发机器上运行不正常。
三、用黄清海的压缩编译软件在其它的机器上有的运行正常,有的不正常,(C/S模式)。
四、在另外一个B机器上重新安装foxpro9.0,用黄清海的压缩编译器,压缩编译后,在B开发机器上运行正常。顼将这个软件放回到原来开发的A机器上,运行,还是又出错。
五、在A开发机器上,重新建一个项目,只加入Foxcharts表单,在菜单程序中调用Foxcharts表单。程序中不设调用错误程序。在A开发机器上,用foxpro的编译器,编译后,运行正常;用黄清海的压缩编译软件,压缩编译后,运行时出现程序错误。按“取消”按钮,不能退出。按“忽略”按钮,出现以下信息提示:
1.不能识别的成员system.。(出现4次)
2.在with/endwith之外此表达式无效。(出现2次)
3.不能识别的成员OGFX。(出现3次)
4.with/endwith不匹配。(出现1次)
5未处理的结构异常。errorNo:2071。(出现1次)
6.不能识别的OBMP.。(出现1次)
六、用类游览器查看
只找到OGFX。System与OBMP.没有找到。现将类游览器查到myFoxchart的代码附后。
PUBLIC oform1
SET CLASSLIB TO d:\students\forms\ffc\foxcharts.vcx ADDITIVE
SET CLASSLIB TO d:\students\forms\solution.vcx ADDITIVE
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
Top = 0
Left = 0
Height = 511
Width = 797
ShowWindow = 0
DoCreate = .T.
Caption = "学生人数"
WindowType = 1
*-- XML Metadata for customizable properties
_memberdata = ""
Name = "Form1"
ADD OBJECT foxcharts1 AS foxcharts WITH ;
Anchor = 15, ;
Top = 0, ;
Left = 0, ;
Width = 792, ;
Height = 474, ;
MouseIcon = "", ;
TabIndex = 3, ;
gradientposition = 0.6, ;
Name = "foxcharts1", ;
Title.FontSize = 11, ;
Title.Name = "Title", ;
SubTitle.FontSize = 16, ;
SubTitle.Name = "SubTitle", ;
XAxis.Name = "XAxis", ;
YAxis.Name = "YAxis", ;
ScaleLegend.Name = "ScaleLegend", ;
AxisLegend2.Name = "AxisLegend2", ;
ShapeLegend.Name = "ShapeLegend", ;
SideLegend.Name = "SideLegend", ;
ChartCanvas._memberdata = [<VFPData><memberdata name="beforedraw" type="method" display="BeforeDraw"/><memberdata name="hdc" type="property" display="HDC"/>
<memberdata name="ogfx" type="property" display="oGfx"/><memberdata name="refresh" type="method" display="Refresh"/><memberdata name="clear" type="method" display="Clear"/>
<memberdata name="draw" type="method" display="Draw"/><memberdata name="controls" type="property" display="Controls"/><memberdata name="setup" type="method" display="SetUp"/>
<memberdata name="save" type="method"<VFPData><memberdata name="beforedraw" type="method" display="BeforeDraw"/><memberdata name="hdc" type="property" display="HDC"/>
<memberdata name="ogfx" type="property" display="oGfx"/><memberdata name="refresh" type="method" display="Refresh"/><memberdata name="clear" type="method" display="Clear"/>
<memberdata name="draw" type="method" display="Draw"/><memberdata name="controls" type="property" display="Controls"/><memberdata name="setup" type="method" display="SetUp"/>
<memberdata name="save" type="method"<VFPData><memberdata name="beforedraw" type="method" display="BeforeDraw"/><memberdata name="hdc" type="property" display="HDC"/>
<memberdata name="ogfx" type="property" display="oGfx"/><memberdata name="refresh" type="method" display="Refresh"/><memberdata name="clear" type="method" display="Clear"/>
<memberdata name="draw" type="method" display="Draw"/><memberdata name="controls" type="property" display="Contr], ;
ChartCanvas.Name = "ChartCanvas", ;
Fields.Name = "Fields", ;
ToolTip.Name = "ToolTip"
ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
Anchor = 4, ;
Caption = "图形:", ;
Height = 17, ;
Left = 537, ;
Top = 484, ;
Width = 38, ;
TabIndex = 4, ;
Name = "Label1"
ADD OBJECT spinner2 AS spinner WITH ;
Anchor = 4, ;
Height = 24, ;
KeyboardHighValue = 50, ;
KeyboardLowValue = 0, ;
Left = 432, ;
SpinnerHighValue = 50.00, ;
SpinnerLowValue = 0.00, ;
TabIndex = 2, ;
Top = 480, ;
Width = 60, ;
Value = 1, ;
Name = "Spinner2"
ADD OBJECT label2 AS label WITH ;
AutoSize = .T., ;
Anchor = 4, ;
Caption = "深度:", ;
Height = 17, ;
Left = 393, ;
Top = 484, ;
Width = 38, ;
TabIndex = 5, ;
Name = "Label2"
ADD OBJECT spinner1 AS spinner WITH ;
Anchor = 4, ;
Height = 24, ;
KeyboardHighValue = 16, ;
KeyboardLowValue = 1, ;
Left = 576, ;
SpinnerHighValue = 16.00, ;
SpinnerLowValue = 1.00, ;
TabIndex = 1, ;
Top = 480, ;
Width = 60, ;
Value = 5, ;
Name = "Spinner1"
ADD OBJECT cmdclose1 AS cmdclose WITH ;
Top = 480, ;
Left = 696, ;
Anchor = 4, ;
TabIndex = 6, ;
Name = "Cmdclose1"
PROCEDURE Load
SET TALK OFF
SET CONSOLE OFF
ENDPROC
PROCEDURE foxchartsshapelegendexpression
ENDPROC
PROCEDURE foxcharts1.Init
#INCLUDE CHARTSTEXTFILE.H
cx="SELECT lianji,sex ,count(*) as '人数' FROM students group by lianji,sex"
=SQLSETPROP(0,"DispLogin",3)
handle=sqlconnect(SQLDSN_LOC,SQLUSER_LOC,SQLPWD_LOC)
if handle>-1
jg=sqlexec(handle,cx,'SQLSTUDENT')
IF jg > -1
SELECT lianji, 人数 as '男' from SQLSTUDENT group by lianji,人数 where sex='男'into curso ltmp
SELECT lianji, 人数 as '女' from SQLSTUDENT group by lianji,人数 where sex='女'into curso ntmp
SELECT 女 as Babies,男 as Infants,(男+女) as Teens,ltmp.lianji as Month from ltmp,ntmp where ltmp.lianji=ntmp.lianji into curso sales2
select sales2
LOCAL loChart
loChart = This
WITH loChart as FoxCharts of FoxCharts.Vcx
.ChartType = 5 && Line
.ChartsCount = 3
.SourceAlias = "Sales2"
.FieldAxis2 = "Month"
.FieldLegend = "Month"
.Fields(1).FieldValue = "Babies" && This is the name of the 1st column of the cursor
.Fields(1).Legend = "女" &&Babies
.Fields(1).Color = RGB(255,20,80) && Red
.Fields(2).FieldValue = "Infants" && This is the name of the 2st column of the cursor
.Fields(2).Legend = "男" &&Children
.Fields(2).Color = RGB(100,175,213) && Blue
.Fields(3).FieldValue = "Teens" && This is the name of the 3st column of the cursor
.Fields(3).Legend = "合计"
.Fields(3).Color = RGB(90,250,50) && Green
.Title.Caption = UNIVERSITY1_LOC+ CLCOLLEGE1_LOC
.SubTitle.Caption = "历年学生"
.FontName = "Tahoma"
.Depth = 1 &&10
.BackColor = RGB(255,255,255)
.ColorType = 1 && 2=Random
.BrushType = 2 && Gradient colors =2
.XAxis.Caption = "各年级(只取前10年)"
.YAxis.Caption = "人数"
.AxisLegend2.Alignment = 0 && Left
.AxisLegend2.Rotation = 45
.AxisLegend2.FontName = "Verdana"
.AxisLegend2.FontSize = 6
.ShowValuesOnShapes = .T.
.ShapeLegendExpression = "TRANSFORM(This.CurrValue) + CHR(13) + CHR(10) + This.CurrLegend"
.DrawChart()
ENDWITH
ELSE
=messagebox(CHECKNO_LOC,16,CAPTIONTISI_LOC)
ENDIF &&jg
ELSE
=messagebox(CONNECTFASE_LOC,16,ERROCAPTION_LOC)
ENDIF
=SQLDISCONNECT(handle)
ENDPROC
PROCEDURE foxcharts1.shapemouseleave
LPARAMETERS nButton, nShift, nXCoord, nYCoord, tnValue, tcLegend, tnCoordIndex
THISFORM.Rect1.visible=.f.
ENDPROC
PROCEDURE foxcharts1.shapemouseenter
LPARAMETERS nButton, nShift, nXCoord, nYCoord, tnValue, tcLegend, tnCoordIndex
local lcLegend, lnLine
lcLegend=this.aCoord(tnCoordIndex,6)
FOR lnLine=1 TO ALEN(this.aCoord,1)
IF this.aCoord(lnLine,11)='Legend' AND this.aCoord(lnLine,6)=lcLegend
IF TYPE('THISFORM.Rect1')='U'
THISFORM.AddObject('Rect1','Shape')
THISFORM.rect1.backstyle=0
ENDIF
THISFORM.Rect1.Left=this.aCoord(lnLine,1)-1
THISFORM.Rect1.width=this.aCoord(lnLine,3)+5
THISFORM.Rect1.Top=this.aCoord(lnLine,2)+this.top-1
THISFORM.Rect1.height=this.aCoord(lnLine,4) + 1
THISFORM.Rect1.visible=.t.
THISFORM.Rect1.BorderColor = RGB(255,0,0)
RETURN
ENDIF
NEXT
ENDPROC
PROCEDURE spinner2.InteractiveChange
IF This.Value = 3
WAIT WINDOW ("Chart not available") NOWAIT
RETURN
ENDIF
IF this.Value < 0
this.Value=0
ELSE
IF this.Value >50
this.Value=50
ENDIF
ENDIF
Thisform.FoxCharts1.Depth = This.Value
Thisform.FoxCharts1.DrawChart()
ENDPROC
PROCEDURE spinner1.InteractiveChange
IF this.Value =< 0
this.Value=1
RETURN
ELSE
IF this.Value >16
this.Value=16
Thisform.FoxCharts1.ChartType = This.Value
Thisform.FoxCharts1.DrawChart()
ENDIF
ENDIF
ENDPROC
PROCEDURE spinner1.KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
7 个解决方案
#1
通过你的测试步骤,很明显是 压缩编译器 的问题。
#2
请教如何解决?
#3
不用第三方编译器。
#4
用foxpro的编译器,编译后,在A开发机器上运行正常。但是,用foxpro的编译器编译的程序,用InstallShield Express5.0打包,安装在其它几个机器上(wibdows XP系统)进行了测试,有的能运行,有的又不能运行。说明,不一定是黄清海的压缩编译器的问题,foxpro的编译器编译的也不能运行。是否另外还有机器上的设置问题?
#5
是这样的,我的也碰到这个问题,在windows xp 、2003、2000下运行没有问题,在win7下运行会跳出:不能识别的成员:system等信息,但是,不会影响图形显示。不知如何解决这个问题。
#6
Yaxis.caption="人数" 去掉,直接在foxchart属性窗口找A yaxis的caption属性写为人数
#7
我也很想知道,关注中
#1
通过你的测试步骤,很明显是 压缩编译器 的问题。
#2
请教如何解决?
#3
不用第三方编译器。
#4
用foxpro的编译器,编译后,在A开发机器上运行正常。但是,用foxpro的编译器编译的程序,用InstallShield Express5.0打包,安装在其它几个机器上(wibdows XP系统)进行了测试,有的能运行,有的又不能运行。说明,不一定是黄清海的压缩编译器的问题,foxpro的编译器编译的也不能运行。是否另外还有机器上的设置问题?
#5
是这样的,我的也碰到这个问题,在windows xp 、2003、2000下运行没有问题,在win7下运行会跳出:不能识别的成员:system等信息,但是,不会影响图形显示。不知如何解决这个问题。
#6
Yaxis.caption="人数" 去掉,直接在foxchart属性窗口找A yaxis的caption属性写为人数
#7
我也很想知道,关注中