vfp表单.docx

上传人:b****6 文档编号:7560679 上传时间:2023-01-25 格式:DOCX 页数:15 大小:597.34KB
下载 相关 举报
vfp表单.docx_第1页
第1页 / 共15页
vfp表单.docx_第2页
第2页 / 共15页
vfp表单.docx_第3页
第3页 / 共15页
vfp表单.docx_第4页
第4页 / 共15页
vfp表单.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

vfp表单.docx

《vfp表单.docx》由会员分享,可在线阅读,更多相关《vfp表单.docx(15页珍藏版)》请在冰豆网上搜索。

vfp表单.docx

vfp表单

和。

“开始”按钮代码:

a=val(thisform.text1.value)fori=1to300

ifi%a=0

thisform.edit1.value=thisform.edit1.value+str(i,6)thisform.text2.value=str(val(thisform.text2.value)+i)endif

endfor

 

 

thisform.text1.value=""thisform.edit1.value=""thisform.text2.value=""

例题2:

在文本框中输入文本,查找编辑框中是否存在。

 

“查找”按钮代码:

m=thisform.text1.textn=at(alltrim(m),thisform.edit1.value)ifn!

=0

thisform.edit1.sellength=len(alltrim(m))else

messagebox("没有相匹配的单词")

endif

 

“退出”按钮代码:

thisform.release

 

例题3:

“查找”按钮代码:

m=thisform.text1.textn=at(alltrim(m),thisform.edit1.value)

ifn!

=0

thisform.edit1.sellength=len(alltrim(m))else

messagebox("没有相匹配的单词")

endif

 

“替换”按钮代码:

ifthisform.edit1.seltext=alltrim(thisform.text1.text)thisform.edit1.seltext=alltrim(thisform.text2.text)

else

messagebox("没有选择需要置换的单词")endif

 

例题4.1:

十进制整数转化二进制

 

“转化”按钮CLICK事件代码

m=thisform.text1.values=""

dowhilem!

=0r=mod(m,2)m=int(m/2)s=alltrim(str(r))+s

enddo

thisform.text2.value=sthisform.refresh

“清除”按钮CLICK事件代码

thisform.text1.value=0thisform.text1.setfocus

thisform.text2.value=0

 

例题4.2十进制转化二进制

“转化”按钮代码:

z=thisform.text1.valuem=int(z)

n=z-ms1=""

s2=""

dowhilem!

=0r=mod(m,2)m=int(m/2)s1=alltrim(str(r))+s1

enddo

 

dowhilen!

=0n=n*2b=int(n)

s2=s2+alltrim(str(b))n=n-b

enddo

 

s=s1+"."+s2

iflen(s1)=0

s="0."+s2

endif

 

iflen(s2)=0

s=s1endif

thisform.text2.value=sthisform.refresh“清除”按钮代码:

thisform.text1.value=0thisform.text2.value=0thisform.text1.setfocus

例题5:

输入三个数,显示最大值,并判断奇偶性。

“判断”按钮代码:

a=val(thisform.text1.value)b=val(thisform.text2.value)c=val(thisform.text3.value)max=a

ifmax

endif

ifmax

max=cendif

ifmax%2=0

thisform.optiongroup1.option2.value=1thisform.optiongroup1.option1.value=0

else

thisform.optiongroup1.option2.value=0thisform.optiongroup1.option1.value=1

endifthisform.label3.caption=alltrim(str(max))

“退出”按钮代码:

thisform.release

 

例题6:

 

数据环境课程.dbf

属性设置:

firstelement1

 

指定组合框或列表框控件中显示的第一个元素

指定用户能否在列表框控件

list1

multiselect.T.

 

nember0fel

中进行多重选定、以及如何进行多重选定

指定数组有多少数据项用来

ement

0填充组合框或列表框控件中

的列表部分

 

“commandgroup1”控件click事件代码

docase

casemandgroup1.value=1forn=1tothisform.list1.listcount

ifthisform.list1.selected(n)thisform.list2.additem(thisform.list1.list(n))

endifendfor

casethis.value=2

thisform.list2.clear

forn=1tothisform.list1.listcountthisform.list2.additem(thisform.list1.list(n))

endfor

casethis.value=3

forn=1tothisform.list2.listcountifthisform.list2.selected(n)

thisform.list2.removeitem(n)

endifendfor

casethis.value=4thisform.list2.clear

endcase

 

“commandgroup1”控件中command1的destroy事件代码

forn=1tothisform.list1.listcountifthisform.list1.selected(n)

thisform.list2.additem(thisform.list1.list(n))

endifendfor

 

例题7:

设置字体

 

“form1”的load事件代码:

publicchx

chx=0

“加粗c”heck1的CLICK事件代码

n=iif(chx=0,.f.,.t.)ifn

thisform.label1.fontbold=.t.else

thisform.label1.fontbold=.f.

endif

 

“commandgroup1”控件click事件代码:

docase

casemandgroup1.value=1thisform.label1.fontname="隶书"

casethis.value=2

thisform.label1.fontname="华文行楷"casethis.value=3

thisform.label1.fontname="华文彩云"casethis.value=4

thisform.label1.fontname="华文新魏"endcase

 

例题8:

模拟石英钟

“form1”控件的load事件代码:

publicss,mm,hh,x,y,x2,y2,x3,y3,x4,y4store0toss,mm,hh

“form1”控件的init事件代码:

x=thisform.width/2y=thisform.height/2thisform.fillcolor=rgb(128,128,255)thisform.circle(100,x,y)

fori=1to12

x1=x+100*cos(i*3.14159/6)y1=y+100*sin(i*3.14159/6)

thisform.fillcolor=rgb(255,188,255)thisform.circle(5,x1,y1)

next

 

“timer1”的timer事件代码:

thisform.forecolor=rgb(128,128,255)x2=x+90*cos((ss-15)*3.14159/30)y2=y+90*sin((ss-15)*3.14159/30)thisform.line(x,y,x2,y2)ss=mod(ss+1,60)

x2=x+90*cos((ss-15)*3.14159/30)y2=y+90*sin((ss-15)*3.14159/30)thisform.forecolor=rgb(255,0,0)thisform.line(x,y,x2,y2)

ifss=0

thisform.forecolor=rgb(128,128,255)x3=x+70*cos((mm-15)*3.14159/30)y3=y+70*sin((mm-15)*3.14159/30)thisform.line(x,y,x3,y3)mm=mod(mm+1,60)

thisform.forecolor=rgb(128,128,255)x4=x+60*cos((hh-3)*3.14159/6)y4=y+60*sin((hh-3)*3.14159/6)thisform.line(x,y,x4,y4)

hh=hh+1/60ifhh>=12

hh=0

endifendif

x3=x+70*cos((mm-15)*3.14159/30)y3=y+70*sin((mm-15)*3.14159/30)THISFORM.forecolor=rgb(0,255,0)x4=x+60*cos((hh-3)*3.14159/6)y4=y+60*sin((hh-3)*3.14159/6)thisform.forecolor=rgb(0,0,0)thisform.line(x,y,x4,y4)

例题9:

输入三个数,对其排序

 

“排序”的CLICK事件代码:

a=val(thisform.text1.value)b=val(thisform.text2.value)c=val(thisform.text3.value)

ifa

t=aa=bb=t

endif

ifa

t=cc=aa=t

endififb

t=bb=cc=t

endifthisform.label2.caption=str(c)thisform.label3.caption=str(b)thisform.label4.caption=str(a)例题10:

闪烁的图片

 

计时器Timer1的init事件代码

publiccccc=-1

计时器Timer1的timer事件代码

cc=-ccifcc=1

thisform.image1.visible=.t.

else

thisform.image1.visible=.f.endif

 

例题11:

数字时钟(按钮显示时间)

属性设置

 

interval5指定调用计时器事件的间隔,以毫

秒为单位

 

计时器Timer1的timer事件代码

thisform.cmn.caption=time()

 

例题12:

表单显示时间

 

属性设置

 

interval100指定调用计时器事件的间隔,以毫

秒为单位

计时器Timer1的timer事件代码

thisform.label1.caption=time()

 

例题13:

对XSDA.DBF表进行排序

数据环境

XSDA.DBF

“选项按钮组”的CLICK事件代码

docase

casethis.value=1

setorderto学号

casethis.value=2

setorderto出生日期

endcasethisform.refresh

 

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1