如何用vfp制作计算器
答案:2 悬赏:30
解决时间 2021-01-07 00:05
- 提问者网友:流星是天使的眼泪
- 2021-01-06 20:13
如何用vfp制作计算器
最佳答案
- 二级知识专家网友:渡鹤影
- 2021-01-06 20:37
1、打开VFP,文件——新建——表单——新建立文件
lable1在属性中设置它的caption属性为"前项"
lable2在属性中设置它的caption属性为"后项"
lable3在属性中设置它的caption属性为"结果"
text1、text2、text3不用设置
optiongroup1的生成器:
command1在属性中设置它的caption属性为“计算”
command2在属性中设置它的caption属性为“退出”
3、接着将属性摆好;
4、接着双击command1,输入click代码:
a=val(alltrim(thisform.text1.value)) &&去除前后空格,并将字符型数据转换为数值型数据
b=val(alltrim(thisform.text2.value)) &&由于文本框默认的数据类型是字符型,所以要转换
if thisform.optiongroup1.value=1
thisform.text3.value=a+b
endif
if thisform.optiongroup1.value=2
thisform.text3.value=a-b
endif
if thisform.optiongroup1.value=3
thisform.text3.value=a*b
endif
if thisform.optiongroup1.value=4
thisform.text3.value=a/b
endif
command2代码:
thisform.release
5、运行,计算器就实现了。
lable1在属性中设置它的caption属性为"前项"
lable2在属性中设置它的caption属性为"后项"
lable3在属性中设置它的caption属性为"结果"
text1、text2、text3不用设置
optiongroup1的生成器:
command1在属性中设置它的caption属性为“计算”
command2在属性中设置它的caption属性为“退出”
3、接着将属性摆好;
4、接着双击command1,输入click代码:
a=val(alltrim(thisform.text1.value)) &&去除前后空格,并将字符型数据转换为数值型数据
b=val(alltrim(thisform.text2.value)) &&由于文本框默认的数据类型是字符型,所以要转换
if thisform.optiongroup1.value=1
thisform.text3.value=a+b
endif
if thisform.optiongroup1.value=2
thisform.text3.value=a-b
endif
if thisform.optiongroup1.value=3
thisform.text3.value=a*b
endif
if thisform.optiongroup1.value=4
thisform.text3.value=a/b
endif
command2代码:
thisform.release
5、运行,计算器就实现了。
全部回答
- 1楼网友:妄饮晩冬酒
- 2021-01-06 21:19
VFP自带一个简易计算器,在命令窗口或程序中输入“activate window calculator”这段代码就可以弹出计算器。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯