apple store充值里充值有什么用

天极传媒:天极网全国分站
您现在的位置: &&
用VFP为可视类增添绘图功能
cpcw 00:00
Visual Foxpro中提供了基于
_Screen和表单窗口的绘图方法,如用Pset、Line画点、线等。然而感到其方法较有限,如有时需绘制圆弧、扇形或想对多边形填充,却发现Visual
Foxpro可视类未提供相应的方法。现笔者找到两种解决方法:
  解决方法之一,可用控件自身的Pset及Point方法根据图形学基本算法设计子程序,该方法速度慢得让人无法忍受且效果不好。解决方法二,调用Windows
API函数。Windows执行过程中常常通过动态连接库(DLLs)支持其所需的许多功能。这些动态函数库加载在中根据需要与用户程序进行连接。API
库中有丰富的图形操作函数。调用API函数有许多优点:功能全、速度快、程序代码小。
  有关访问API函数的文章已不少,这里不再重复。然而使用API函数在窗口或设备中绘图时,必须得到该窗口或设备的句柄HDC。在Visual Foxpro参考函数中却找不到获得HDC的方法,虽然可用API中的GetDc函数获得某窗口的HDC。但该函数又需用到窗口句柄作参数。如何获得窗口句柄呢?API函数(如:GetActiveWindow,
GetWindow等)直接返回的是整个程序窗口句柄,而用户窗口一般是应用程序中的一个文档窗。 其实在VFP中返回用户窗口一个很方便的方法是通过FOXTOOLS.FLL库中WOnTop和WhToHwnd函数。上述函数语法如下:
  WHANDLE WonTop()* 返回用户使用的活动窗口WHandle
  HWND WhToHwnd(WHandle)* 返回相应的窗口句柄hWnd。
  HDC GetDC(hWnd)* 返回指定窗口hWnd的设备句柄hDC
  有了设备句柄调用绘图函数则很容易,例如:画矩形的API函数语法如下:
  BOOL Rectangle(hDC,x1,y1,x2,y2)
  其中x1,y1,x2,y2为矩形对角线的x,y坐标
  使用这些API函数绘图需注意几点:
  1.API函数使用前需用declare声明,另外应注意函数名称大小写(具体用法见文后程序)。
  2.调用以上函数时,WHandle、hWnd、hDc、x1、y1、x2、y2参数及BOOL均可用Integer类型进行说明,以上函数返回值若为0,表示调用失败。
  3.Visual FoxPro设置前景色、填充色等属性设置不影响API函数中绘图方式。
  4.使用Visual FoxPro原类方法的绘图方法时,会清除API画的图形。因此,两者最好不要混合使用。
  5.API函数参数中若有复合数据结构或数组,则应将该数据结构转换成String型。如下例语句可在VFP中调用Polygon函数绘制多边形。
  declare integer Polygon in wi
api integer, string ,integer
  dime point(3,2)* point为三角形顶点坐标
  trangle=′′
  for i=1 to 3
  point(i,1)=100+100*rand()* I点X坐标为(100~200)随机数
  point(i,2)=100+100*rand()* I点Y坐标为(100~200)随机数
  以下两条语句将多边形顶点的数值转化为字符,并连入字符串
  trangle=trangle+chr(point(i,1))+chr(0)+chr(0)+chr(0)
  trangle=trangle+chr(point(i,2))+chr(0)+chr(0)+chr(0)
  endfor
  polygon(thisform.hdc,trangle,3)
  VPF中打开一个表单,在表单中新建属性并新建API函数编制的绘图方法,最后将其保存为新类库。这样一个集绘图与原表单各种功能的可视类就建好了。
  以下是Visual Foxpro中用API函数动态设计饼形图的简单实例。图为执行程序后屏幕输出。三个文本框中任一数据改变后,饼形图将立即重绘。
  程序:
  为Form对象增加新属性hDc和新方法Pie。
  Form1的Load 事件:
  declare integer GetDC in win32api integer
  declare integer Pie in win32api integer,integer,integer,integer,;
integer,integer,integer,integer,integer
  declare integer CreateSolidBrush in win32api long
  declare integer SelectObject in win32api integer,integer
  declare integer CreatePen in win32api integer,integer,long
  set library to sys(2004)+″foxtools.fll″
  Form1的Activate事件
  whandle=_WOnTop()
  hwnd=_WhToHwnd(whandle)
  set library to
  thisform.hDC=GetDC(hwnd)
  Form1的Pie方法
  lparameters x1,y1,x2,y2,x3,y3,x4,y4
  hbrush=CreateSolidBrush(thisform.fillcolor)
  hpen=Createpen(thisform.drawstyle,thisform.drawwidth,thisform.forecolor)
  =selectobject(thisform.hdc,hbrush)
  =selectobject(thisform.hdc,hpen)
  =pie(thisform.hdc,x1,y1,x2,y2,x3,y3,x4,y4)
  Form1的Unload事件
  clear dlls
  将本表单保存为新的可视类FORMDRAW。
  创建一个Form(FORMDRAW为其可视类)、添加四个Label、三个Text(Value属性分别赋三个数值)和三个Shape对象,属性设置略(使其外观如图),为FORM增加方法Drawchar。
  表单的Drawchart方法:
  x1=thisform.text1.value
  x2=thisform.text2.value
  x3=thisform.text3.value
  total=x1+x2+x3
  a1=2*pi()*x1/total
  a2=2*pi()*x2/total
  x1=250
  x2=350
  y2=150
  mx=(x1+x2)/2-1
  my=(y1+y2)/2-1
  thisform.fillcolor=255
  =thisform.pie(x1,y1,x2,y2,mx+10,my,mx+10*cos(a1),my-10*sin(a1))
  thisform.fillcolor=rgb(0,255,0)
  =thisform.pie(x1,y1,x2,y2,mx+10*cos(a1),my-10*sin(a1),mx+10*cos(a1+a2),
  -10*sin(a1+a2))
  thisform.fillcolor=rgb(0,0,255)
  =thisform.pie(x1,y1,x2,y2,mx+10*cos(a1+a2),my-10*sin(a1+a2),mx+10,my)
  Text1、Text2、Text3的Valid事件:
  Thisform.drawchart
  表单的Paint事件
  Thisform.drawchart
  用API函数绘图与Visual FoxPro自身方法相比,使用更灵活、绘图性能强且速度快。关于Windows API 函数功能及用法请查阅有关资料。本文所述方法亦可在能与API函数通讯的其它软件中使用。
(作者:请作者与我们联系责任编辑:)
欢迎在新浪微博上关注我们
笔记本手机数码家电如何在VFP程序表单中,自动画出统计图形
如何在VFP程序表单中,自动画出统计图形
qz4365liuriliuri、qz4365Chiff1020807
用VFP图形向导,可以画出统计图形。在程序中如何实现呢? &
统计图形需要随下表中数据的变化而变化。(数据有变化,记录数也有变化。) &
表:部门 & &收入 &
& & & &01 & & & &240 &
& & & &02 & & & &260 &
& & & &03 & & & &270 &
& & & &04 & & & &230 &
& & & &.. & & & &... &
--------------------------------------------------------------- &
用mschart控件 &
--------------------------------------------------------------- &
给你一段代码看看吧.(在form中要先添加一个oldboundcontrol的控件) &
sele &pdate &as &month,& &
& & & & &from &tmp_costcal1; &
& & & & &where &tmp_costcal1.prodno==allt(thisform.kftextbox1.value) &.and. &tmp_costcal1.pdate&date()-5*30; &
& & & & &into &cursor &tmp_costcal2 &
sele &tmp_costcal2 &
lgdata=&& &
& &lgdata=lgdata+chr(9)+str(month(month),2)+&月& &
lgdata=lgdata+chr(13)+chr(10) &
for &lfcount=2 &to &fcount() &
& &lgdata=lgdata+field(lfcount) &
& & & &lvar=field(lfcount) &
& & & &lgdata=lgdata+chr(9)+allt(str(&lvar.,10,2)) &
& &endscan &
& &lgdata=lgdata+CHR(13)+CHR(10) &
creat &cursor &tmp_graph &(graph &g) &
sele &tmp_graph &
appe &blan &
appe &general &graph &data &lgdata & &class &&msgraph.chart& &
thisform.oleboundcontrol1.controlsource=&tmp_graph.graph& &您现在的位置: &
如何在VFP中实现动态统计图形[4]
&&& loForm=CREATEOBJECT("FORM")  loForm.ADDOBJECT("Lhole","OLEBOUNDCONTROL")  loForm.Lhole.STRETCH=2  lcCsource=lcSavetable+"."+lcFname  loForm.Lhole.CONTROLSOURCE=lcCsource  loForm.Lhole.HEIGHT= _SCREEN.HEIGHT  loForm.Lhole.WIDTH=_SCREEN.WIDTH  lcError=ON("ERROR")  ON ERROR APPEND GENERAL &lcFname  DATA lcData CLASS "MSGRAPH.CHART"  loForm.Lhole.HasLegend=llLegend  IF ISBL(lcTitle)  loForm.Lhole.HasTitle = .F.  ELSE  loForm.Lhole.HasTitle = .T.  loForm.Lhole.ChartTitle.Caption = lcTitle  ENDIF  IF lnMtype& &0 .AND. lnStype& &0  loForm.Lhole.AutoFormat(lnMtype,lnStype)  ENDIF  IF !ISBL(lcError)  ON ERROR &lcError  ELSE  ON ERROR  ENDIF  loForm.RELEASE  * FLUSH  IF llOpensTAble  USE  ENDIF  SELE (lnCURSELE)[] &[] &[] &[4] &[] &VFP5.0中控制Ms Graph图形的显示过程--《电脑编程技巧与维护》1998年01期
VFP5.0中控制Ms Graph图形的显示过程
【摘要】:正 将我们的数据通过MS Graph工具以图形的方式显示出来,其过程一直是FoxPro数据库应用系统开发中一个比较棘手的问题。在FoxPro 2.5和Visual FoxPro 3.0环境对这一问题的解决曾有过许多有益的探讨,人们千方百计曾想出一些办法勉勉强强地可以在应用中显示一些图形出来了,但是实施起来并不是一件那么轻松的事情,而且对已经显示出来的图形再进行一些实用的控制,譬如说改变该图形的显示方式等等,就更不是那么容易了。 在微软的新产品Visual FoxPro 5.0中,上述的图形显示和控制问题我们可以找到一个比较灵活而简单的解决方式。本文将以一个实例,向你展示如何有效地将MS Gra
【作者单位】:
【关键词】:
【分类号】:TP311.52【正文快照】:
将我们的数据通过MS Graph工具以图形的方式显示出来,其过程一直是FoxPro数据库应用系统开发中一个比较棘手的问题。在FoxPro 2.5和visu一。l FoxPro 3.O环境对这一问题的解决曾有过许多有益的探讨。人们千方百计曾想出一些办法勉勉强强地可以在应用中显示一些图形出来了,但
欢迎:、、)
支持CAJ、PDF文件格式,仅支持PDF格式
【相似文献】
中国期刊全文数据库
罗辉;[J];电脑编程技巧与维护;1995年02期
周佩德;[J];电脑知识与技术;1995年01期
陈建亮;[J];中国计算机用户;1996年22期
吴会松;[J];电脑;1997年12期
吴会松;[J];电子与电脑;1997年12期
吴会松;[J];软件世界;1997年05期
李晓华;[J];电脑编程技巧与维护;1997年11期
李晓华;[J];电脑编程技巧与维护;1997年12期
李仕华;[J];中国计算机用户;1997年31期
吴会松;[J];中国计算机用户;1997年33期
&快捷付款方式
&订购知网充值卡
400-819-9993
《中国学术期刊(光盘版)》电子杂志社有限公司
同方知网数字出版技术股份有限公司
地址:北京清华大学 84-48信箱 大众知识服务
出版物经营许可证 新出发京批字第直0595号
订购热线:400-819-82499
服务热线:010--
在线咨询:
传真:010-
京公网安备75号VFP在表单上画图(画直线、曲线等)
我的图书馆
VFP在表单上画图(画直线、曲线等)
1727人阅读
&本示例并没有应用GDI+
Public oform1oform1=Newobject("form1")oform1.ShowReturn&
Define Class form1 As Form&
Top = 1Left = 1Height = 500Width = 700ScrollBars = 0DoCreate = .T.ShowTips = .F.Picture = ""BorderStyle = 2Caption = "DrawLine"MaxButton = .F.MousePointer = 2KeyPreview = .F.AlwaysOnTop = .F.BackColor = Rgb(255,255,255)Name = "Form1"
Add Object shape1 As Shape With ;&&& Top = -5, ;&&& Left = 500, ;&&& Height = 510, ;&&& Width = 250, ;&&& BackStyle = 1, ;&&& BorderStyle = 1, ;&&& BorderWidth = 5, ;&&& MousePointer = 1, ;&&& BackColor = Rgb(128,255,255), ;&&& BorderColor = Rgb(0,0,255), ;&&& Name = "Shape1"
Add Object spinner_linewidth As Spinner With ;&&& Height = 24, ;&&& InputMask = "99", ;&&& KeyboardHighValue = 50, ;&&& KeyboardLowValue = 1, ;&&& Left = 544, ;&&& SpinnerHighValue = 50.00, ;&&& SpinnerLowValue = 1.00, ;&&& Top = 174, ;&&& Width = 120, ;&&& Value = 1, ;&&& Name = "Spinner_LineWidth"
Add Object command_clearline As CommandButton With ;&&& Top = 441, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "清除线条", ;&&& Name = "Command_ClearLine"
Add Object line_sample As Line With ;&&& BorderWidth = 1, ;&&& Height = 0, ;&&& Left = 544, ;&&& Top = 50, ;&&& Width = 120, ;&&& LineSlant = "/", ;&&& Name = "Line_Sample"
Add Object command_linecolor2 As CommandButton With ;&&& Top = 306, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "红色", ;&&& ForeColor = Rgb(255,0,0), ;&&& Name = "Command_LineColor2"
Add Object label2 As Label With ;&&& AutoSize = .T., ;&&& BackStyle = 0, ;&&& Caption = "线条宽度:(像素)", ;&&& Height = 16, ;&&& Left = 544, ;&&& Top = 158, ;&&& Width = 92, ;&&& Name = "Label2"
Add Object label4 As Label With ;&&& AutoSize = .T., ;&&& BackStyle = 0, ;&&& Caption = "线条颜色:", ;&&& Height = 16, ;&&& Left = 544, ;&&& Top = 268, ;&&& Width = 56, ;&&& Name = "Label4"
Add Object og_linetype As OptionGroup With ;&&& AutoSize = .F., ;&&& ButtonCount = 2, ;&&& BackStyle = 0, ;&&& BorderStyle = 1, ;&&& Value = 1, ;&&& Height = 26, ;&&& Left = 544, ;&&& Top = 118, ;&&& Width = 120, ;&&& Name = "OG_LineType", ;&&& Option1.BackStyle = 0, ;&&& Option1.Caption = "直线", ;&&& Option1.Value = 1, ;&&& Option1.Height = 16, ;&&& Option1.Left = 5, ;&&& Option1.Style = 0, ;&&& Option1.Top = 5, ;&&& Option1.Width = 45, ;&&& Option1.AutoSize = .T., ;&&& Option1.Name = "Option1", ;&&& Option2.BackStyle = 0, ;&&& Option2.Caption = "曲线", ;&&& Option2.Height = 16, ;&&& Option2.Left = 69, ;&&& Option2.Style = 0, ;&&& Option2.Top = 5, ;&&& Option2.Width = 45, ;&&& Option2.AutoSize = .T., ;&&& Option2.Name = "Option2"
Add Object label1 As Label With ;&&& AutoSize = .T., ;&&& BackStyle = 0, ;&&& Caption = "线条类型:", ;&&& Height = 16, ;&&& Left = 544, ;&&& Top = 103, ;&&& Width = 56, ;&&& Name = "Label1"
Add Object combo_linestyle As ComboBox With ;&&& RowSourceType = 1, ;&&& RowSource = "实线,虚线,点线,点划线,双点划线,内实线,透明", ;&&& Height = 24, ;&&& Left = 544, ;&&& MousePointer = 0, ;&&& Style = 2, ;&&& Top = 229, ;&&& Width = 120, ;&&& ReadOnly = .F., ;&&& Name = "Combo_LineStyle"
Add Object label3 As Label With ;&&& AutoSize = .T., ;&&& BackStyle = 0, ;&&& Caption = "线条样式:", ;&&& Height = 16, ;&&& Left = 544, ;&&& Top = 213, ;&&& Width = 56, ;&&& Name = "Label3"
Add Object label0 As Label With ;&&& AutoSize = .T., ;&&& FontBold = .T., ;&&& FontSize = 12, ;&&& WordWrap = .F., ;&&& BackStyle = 0, ;&&& Caption = "此示列运行于 VFP9.0", ;&&& Enabled = .T., ;&&& Height = 20, ;&&& Left = 518, ;&&& Top = 482, ;&&& Width = 167, ;&&& ForeColor = Rgb(0,0,255), ;&&& Name = "Label0"
Add Object command_linecolor3 As CommandButton With ;&&& Top = 330, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& FontBold = .F., ;&&& Caption = "绿色", ;&&& ForeColor = Rgb(0,255,0), ;&&& Name = "Command_LineColor3"
Add Object command_linecolor4 As CommandButton With ;&&& Top = 354, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "蓝色", ;&&& ForeColor = Rgb(0,0,255), ;&&& Name = "Command_LineColor4"
Add Object command_linecolor5 As CommandButton With ;&&& Top = 378, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "自定义颜色", ;&&& ForeColor = Rgb(255,128,0), ;&&& Name = "Command_LineColor5"
Add Object command_lineerase As CommandButton With ;&&& Top = 417, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "像皮擦", ;&&& ForeColor = Rgb(255,255,255), ;&&& Name = "Command_LineErase"
Add Object command_linecolor1 As CommandButton With ;&&& Top = 282, ;&&& Left = 544, ;&&& Height = 25, ;&&& Width = 120, ;&&& Caption = "黑色", ;&&& ForeColor = Rgb(0,0,0), ;&&& Name = "Command_LineColor1"
Procedure Unload&&& Release gaBezierPointsEndproc
Procedure Load&&& Public gaBezierPoints[4,2]&&& gaBezierPoints[1,1]=0&&& gaBezierPoints[1,2]=0&&& gaBezierPoints[2,1]=80&&& gaBezierPoints[2,2]=25&&& gaBezierPoints[3,1]=0&&& gaBezierPoints[3,2]=75&&& gaBezierPoints[4,1]=100&&& gaBezierPoints[4,2]=100Endproc
Procedure MouseDown&&& Lparameters nButton,nShift,nXCoord,nYCoord&&& If This.MousePointer=2&&&&&&& This.CurrentX=nXCoord&&&&&&& This.CurrentY=nYCoord&&& EndifEndproc
Procedure MouseUp&&& Lparameters nButton,nShift,nXCoord,nYCoord&&& If nButton=1 And Thisform.OG_LineType.Value=1 And nXCoord&=500&&&&&&& Thisform.Line(This.CurrentX,This.CurrentY,nXCoord,nYCoord)&&& EndifEndproc
Procedure MouseMove&&& Lparameters nButton,nShift,nXCoord,nYCoord&&& If nXCoord&500&&&&&&& This.MousePointer=1&&& Else&&&&&&& This.MousePointer=2&&& Endif&&& If nButton=1 And This.MousePointer=2 And Thisform.OG_LineType.Value=2&&&&&&& This.Line(This.CurrentX,This.CurrentY,nXCoord,nYCoord)&&& EndifEndproc
Procedure spinner_linewidth.InteractiveChange&&& If This.Value&50&&&&&&& This.Value=50&&& Endif&&& If This.Value&1&&&&&&& This.Value=1&&& Endif&&& Thisform.Combo_LineStyle.ListItemId=1&&& If This.Value&1&&&&&&& Thisform.Combo_LineStyle.Enabled=.F.&&& Else&&&&&&& Thisform.Combo_LineStyle.Enabled=.T.&&& Endif&&& Thisform.Combo_LineStyle.InteractiveChange()&&& Store This.Value To Thisform.DrawWidth,Thisform.Line_Sample.BorderWidth&&& Thisform.Line_Sample.RefreshEndproc
Procedure command_clearline.Click&&& Thisform.ClsEndproc
Procedure command_linecolor2.Click&&& Store Rgb(255,0,0) To Thisform.Line_Sample.BorderColor,Thisform.ForeColor&&& Thisform.Line_Sample.RefreshEndproc
Procedure og_linetype.InteractiveChange&&& If This.Value=1&&&&&&& Thisform.line_Sample.Polypoints=""&&&&&&& Thisform.Line_Sample.LineSlant="/"&&&&&&& Thisform.Line_Sample.Move(544,50,120,0)&&& Else&&&&&&& Thisform.line_Sample.Polypoints="gaBezierPoints"&&&&&&& Thisform.line_Sample.LineSlant='S'&&&&&&& Thisform.Line_Sample.Move(530,5,150,80)&&& Endif&&& Thisform.Line_Sample.RefreshEndproc
Procedure combo_linestyle.InteractiveChange&&& Do Case&&&&&&& Case This.DisplayValue="实线"&&&&&&&&&&& Thisform.DrawStyle=0&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=1&&&&&&& Case This.DisplayValue="虚线"&&&&&&&&&&& Thisform.DrawStyle=1&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=2&&&&&&& Case This.DisplayValue="点线"&&&&&&&&&&& Thisform.DrawStyle=2&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=3&&&&&&& Case This.DisplayValue="点划线"&&&&&&&&&&& Thisform.DrawStyle=3&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=4&&&&&&& Case This.DisplayValue="双点划线"&&&&&&&&&&& Thisform.DrawStyle=4&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=5&&&&&&& Case This.DisplayValue="内实线"&&&&&&&&&&& Thisform.DrawStyle=6&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=6&&&&&&& Case This.DisplayValue="透明"&&&&&&&&&&& Thisform.DrawStyle=5&&&&&&&&&&& Thisform.Line_Sample.BorderStyle=0&&& Endcase&&& Thisform.Line_Sample.RefreshEndproc
Procedure combo_linestyle.Init&&& This.ListItemId=1Endproc
Procedure command_linecolor3.Click&&& Store Rgb(0,255,0) To Thisform.Line_Sample.BorderColor,Thisform.ForeColor&&& Thisform.Line_Sample.RefreshEndproc
Procedure command_linecolor4.Click&&& Store Rgb(0,0,255) To Thisform.Line_Sample.BorderColor,Thisform.ForeColor&&& Thisform.Line_Sample.RefreshEndproc
Procedure command_linecolor5.Click&&& lnColor=Getcolor(Thisform.Line_Sample.BorderColor)&&& If lnColor#-1&&&&&&& Store lnColor To Thisform.Line_Sample.BorderColor,Thisform.ForeColor&&&&&&& Thisform.Line_Sample.Refresh&&& EndifEndproc
Procedure command_lineerase.Click&&& Store Rgb(255,255,255) To Thisform.ForeColor&&& Thisform.OG_LineType.Value=2&&& Thisform.OG_LineType.InteractiveChange()&&& Thisform.Line_Sample.RefreshEndproc
Procedure command_linecolor1.Click&&& Store Rgb(0,0,0) To Thisform.Line_Sample.BorderColor,Thisform.ForeColor&&& Thisform.Line_Sample.RefreshEndproc
TA的推荐TA的最新馆藏[转]&[转]&[转]&[转]&[转]&

我要回帖

更多关于 apple store充值卡 的文章

 

随机推荐