VF考试表单题.docx
《VF考试表单题.docx》由会员分享,可在线阅读,更多相关《VF考试表单题.docx(27页珍藏版)》请在冰豆网上搜索。
VF考试表单题
一、表单设计。
1、shape.scx
参考解答:
######
formForm1
Caption="画图"
######
shapeShape1
Height=60
Width=100
Top=30
Left=40
BorderColor=0,0,255
######
commandCommand1
Caption="画图"
######
commandCommand2
Caption="清屏"
######
2、jpb.scx
参考解答:
######
formForm1
Caption="奖牌查询"
######
listList1
RowSourceType=6
RowSource="country.国家名称"
######
optiongroupOptiongroup1
ButtonCount=3
Option1.Caption="金牌"
Option2.Caption="银牌"
Option3.Caption="铜牌"
######
commandCommand1
Caption="查询"
######
3、imsh2.scx
参考解答:
######
formForm1
Caption="形状图像"
######
labelLabel1
FontBold=.T.
FontSize=18
BackStyle=0
Caption="秋天"
ForeColor=255,255,0
######
imageImage1
Picture=autumn.jpg
Stretch=2
######
4、sjrq2.scx
参考解答:
######
formForm1
Caption="显示日期时间"
######
pageframePageframe1
PageCount=2
Page1.Caption="日期"
Page2.Caption="时间"
######
labellabel1
FontItalic=.T.
FontSize=14
Caption=(DTOC(DATE()))
######
labellabel2
Caption=(TIME())
######
5、OY2.scx
参考解答:
######
labelLabel1
FontName="隶书"
FontSize=32
BackStyle=0
Caption="北京欢迎您"
Left=70
Top=24
######
labelLabel2
FontName="隶书"
FontSize=32
BackStyle=0
Caption="北京欢迎您"
Left=73
Top=21
ForeColor=255,0,0
######
6、horse.scx
参考解答:
######
formForm1
ShowTips=.T.
######
labelLabel1
Caption="你认识吗?
"
AutoSize=.T.
FontSize=20
######
imageImage1
Picture=..\..\fjexam95\zebra.bmp
BorderColor=255,255,255
ToolTipText="斑马"
######
7、Selball2.scx
参考解答:
######
formForm1
AutoCenter=.T.Caption="选择"
######
optiongroupOptiongroup1
ButtonCount=3
Option1.Caption="选1号"
Option2.Caption="选2号"
Option3.Caption="选3号"
Option1.Top=5
Option2.Top=5
Option3.Top=5
######
commandgroupCommandgroup1
ButtonCount=2
Command1.Caption="确定"Command2.Caption="取消"
Command1.Top=5
Command2.Top=5
######
8、dxxz2.scx
参考解答:
######
formForm1
Caption="多项选择"
######
checkCheck1
Caption="选择1"
AutoSize=.T.
######
checkCheck2
Caption="选择2"
AutoSize=.T.
######
commandgroupCommandgroup1
Command1.Caption="确定"
Command2.Caption="取消"
######
9、combo.scx
参考解答:
######
formForm1
Caption="选择"
######
labelLabel1
Caption="请选择"
######
comboboxCombo1
RowSourceType=1
RowSource="VB,VFP,C语言"
######
checkboxCheck1
Caption="总成绩"
######
checkboxCheck2
Caption="平均成绩"
######
10、edit.scx
参考解答:
######
formForm1
Caption="显示"
######
editboxEdit1
FontName="楷体"
Alignment=2
Value=居中显示
######
textboxText1
Value=(date())
FontBold=.T.
ForeColor=100,0,100
BackColor=200,200,255
######
二、表单编程。
1、ddcx.scx
参考解答:
●设置对象text1的value属性为“=date()”
●对象command1(查询按钮)的click事件
rq=thisform.text1.value
thisform.grid1.recordsource="sele订单号,签订日期,金额fromorders;
where签订日期>=rqintocursorls"
thisform.refresh
2、sjtj.scx
参考解答:
●对象command1(统计按钮)的click事件
zl=bo1.value
selesum(数量),sum(数量*单价)frombook1where种类=zlintoarraya
thisform.text1.value=a(1,1)
thisform.text2.value=a(1,2)
thisform.refresh
3、login2.scx
参考解答:
●对象command1(确定按钮)的click事件
xh=alltrim(thisform.text1.value)
mm=alltrim(thisform.text2.value)
sele姓名fromstulogwherealltrim(学号)==xhandalltrim(密码)==mmintocursorls
ifreccount()=0
thisform.label3.caption="学号或密码不对"
else
thisform.label3.caption="欢迎"+alltrim(姓名)+"同学"
endif
thisform.refresh
4、adds.scx
参考解答:
●对象command1(计算按钮)的click事件
replall金额with单价*数量
thisform.refresh
●对象check1(复选框)的click事件
ifthis.value=1
mand1.enabled=.t.
else
mand1.enabled=.f.
endif
5、jscx.scx
参考解答:
●设置对象combo1的属性
######
rowsourcetype=”6-字段”
rowsource=”teach1.教师号”
######
●对象combo1的init事件
this.listindex=1
●对象combo1的click事件
sele系名fromddm1,teach1whereddm1.系号=teach1.系号and教师号=this.value;
intoarraysz
thisform.text1.value=sz(1,1)
thisform.refresh
6、tsxz.scx
参考解答:
●对象optiongroup1的click事件
selesum(数量),sum(数量*单价)frombook1where种类=bo1.valueintoarraysz
ifthis.value=1
thisform.text1.value=sz(1,1)
else
thisform.text1.value=sz(1,2)
endif
thisform.refresh
7、ddpx.scx
参考解答:
●对象command1(生成表按钮)的click事件
ifthisform.optiongroup1.value=1
sele职员号,avg(金额)as平均金额fromordersgroupby职员号;
orderby平均金额intotablepx_a
else
sele职员号,avg(金额)as平均金额fromordersgroupby职员号;
orderby平均金额descintotablepx_b
endif
8、chadate.scx
参考解答:
●设置对象text1的value属性为“=date()”
●对象spinner1的upclick事件
thisform.text1.value=thisform.text1.value+1
thisform.refresh
●对象spinner1的downclick事件
thisform.text1.value=thisform.text1.value-1
thisform.refresh
9、min.scx
参考解答:
●对象command1(按从小到大排列按钮)的click事件
a=thisform.text1.value
b=thisform.text2.value
ifa>b
t=a
a=b
b=t
endif
thisform.text3.value=a
thisform.text4.value=b
10、calc.scx
参考解答:
●对象command1(计算按钮)的click事件
x=thisform.text1.value
ifx<10
y=x/3
else
ifx<20
y=2*x+1
else
y=3*x-10
endif
endif
thisform.text2.value=y
11、xsys.scx
参考解答:
●对象command1(更新按钮)的click事件
r=thisform.spinner1.value
g=thisform.spinner2.value
b=thisform.spinner3.value
thisform.shape1.backcolor=rgb(r,g,b)
ifr=255andg=0andb=0
thisform.shape1.curvature=0
else
ifr=0andg=0andb=255
thisform.shape1.curvature=99
else
thisform.shape1.curvature=1
endif
endif
thisform.refresh
12、js.scx
参考解答:
●对象command1(计算按钮)的click事件
n=0&&给个数n赋初值
s=0&&给和s赋初值
***********在两线条间完成其他语句**************
fori=0to100
ifi%7=0
n=n+1
s=s+i
endif
endfor
***********************************************
thisform.text1.value=n
thisform.text2.value=s
thisform.refresh
13、addcal.scx
参考解答:
●对象command1(添加并计算按钮)的click事件
s=thisform.text1.value
l=str(len(s))
thisform.list1.additem(s)
thisform.list2.additem(l)
thisform.refresh
14、SelPag.SCX
参考解答:
●对象page1(天空页)的click事件
this.backcolor=rgb(0,0,255)
thisform.refresh
●对象page2(沙漠页)的click事件
this.backcolor=rgb(255,255,0)
thisform.refresh
●对象page3(雪原页)的click事件
this.backcolor=rgb(255,255,255)
thisform.refresh
15、ddtj.scx
参考解答:
●对象command1(统计按钮)的click事件
ifthisform.optiongroup1.value=1
thisform.grid1.recordsource="sele客户号,count(订单号)as订单数,sum(金额)as总金额;
fromordersgroupby客户号intocursorls"
endif
ifthisform.optiongroup1.value=2
thisform.grid1.recordsource="sele职员号,count(订单号)as订单数,sum(金额)as总金额;
fromordersgroupby职员号intocursorls"
endif
thisform.refresh
16、rccx.scx
参考解答:
●对象command1(显示按钮)的click事件
bh=bo1.value
thisform.list1.rowsource="sele姓名,成果名称,成果类别fromrcda,cjda;
wherercda.人才编号=cjda.人才编号andrcda.人才编号=bhintocursorls"
thisform.refresh
17、teach1.scx
参考解答:
●对象combo1的init事件
this.listindex=1
●对象combo1的click事件
seleavg(基本工资)fromddm1,teach1whereddm1.系号=teach1.系号;
and系名=this.valueintoarraya
ifthisform.check1.value=0
thisform.text1.value=""
else
thisform.text1.value=a(1,1)
endif
thisform.refresh
18、leapyear.scx
参考解答:
●对象command1(是否闰年按钮)的click事件
y=year(thisform.text1.value)
if(y%4=0andy%100!
=0)ory%400=0
thisform.text2.value="是闰年"
else
thisform.text2.value="不是闰年"
endif
thisform.refresh
19、factor.scx
参考解答:
●对象command1(因子个数按钮)的click事件
n=thisform.text1.value
js=0
fori=1ton-1
ifn%i=0
js=js+1
endif
endfor
thisform.text2.value=js
thisform.refresh
20、stat.scx
参考解答:
●对象command1(数字字符个数按钮)的click事件
s=alltrim(thisform.text1.value)
n=len(s)
js=0
fori=1ton
c=substr(s,i,1)
ifc>="0"andc<="9"
js=js+1
endif
endfor
thisform.text2.value=js
thisform.refresh