VF编写简易计算器,第1张

VF编写简易计算器,第2张

(1)建立应用程序用户界面。
选择“新建”表单,进入表单设计器,添加文本框控件Textl、标签控件Label1和命令按钮组CommandGroup1,并将命令按钮组的ButtonCount属性更改为16。
(2)设置对象属性如下表所示:
Command group 1中各按钮的属性设置
对象属性的属性值描述
Command 1 ~ Command 10 caption修改为:1,2,3,4,5,6,7,8,9,0[/br]font . t .
Command 11 ~ Command 10 caption修改为:。、=、+、-、*、/
FontBold .T.
(3)编写程序代码。
①编写CommandGroup1的Click事件代码:
if this form.tag =。t .
this form . text 1 . value = all(right(str(this . value)),1))
THISFORM。tag =〃〃
ELSE
a = this form。Text1.Value
此表单。text 1 . Value = a+ALLT(RIGHT(STR(THIS。Value),1)
endif
②写入“.”的点击事件代码button command 11:
a = this form . text 1 . value
this form . text 1 . value = a+〃。[/br ③编写“=”按钮命令的Click事件代码12:
a = this form . text 1 . value
this form . text 1 . value = all(str(& a))
this form . tag =。T.
④编写“+”按钮命令的Click事件代码13:
a = this form . text 1 . value
this form . text 1 . value = a+〃+〃
this form . tag =〃。⑤写出“-”按钮命令的点击事件代码14:
a = this form . text 1 . value
this form . text 1 . value = a+⏾-⏾
this form . tag =⏾。点击按钮命令15的事件代码:
a = this form . text 1 . value
this form . text 1 . value = a+〃*〃
this form . tag =〃〃
a = this form。Text1.Value
此表单。text 1 . Value = a+〃+〃
this form。tag =〃〆

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » VF编写简易计算器

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情