您好,欢迎来到意榕旅游网。
搜索
您的当前位置:首页VF课程设计

VF课程设计

来源:意榕旅游网


数据库原理与应用课程设计报告

实训任务一:

1、在编辑框中输出101~500之间的所有奇数,并将这些奇数之和显示在文本框中。 2、求出所有小于或等于100的自然数对并显示在列表框中。(自然数对是指两个自然数的和与差都是平方数)

3、创建一个浏览学生“成绩表”的表单。

实训任务1:在编辑框中输出101~500之间的所有奇数,并将这些奇数之和显示在文本框中。 实现方法: 对象 Label1 Label2 Text1 Edit1 Command1 Command2 属性 caption caption value ReadOnly ReadOnly caption caption 属性值 101-500间的奇数: 101-500间的奇数的和为: 0 .T. .T. 输出 关闭 程序代码: Command1的Click事件代码: s=0

for i=101 to 500 if i/2<>int(i/2)

thisform.edit1.value=thisform.edit1.value+\" \"+str(i,3) s=s+i endi next

thisform.text1.value=s

Command2的Click事件代码: thisform.release

实训任务2:求出所有小于或等于100的自然数对并显示在列表框中。(自然数对是指两个自然数的和与差都是平方数) 实现方法: 对象 List1 Command1 Command2 程序代码:

Command1的Click事件代码: he=0 cha=0 x=\"\"

for i=100 to 1 step-1 for j=1to i cha=i-j he=i+j

if sqrt(cha)=int(sqrt(cha)).and.sqrt(he)=int(sqrt(he)) x=str(i,3)+\" \"+str(j,3) thisform.list1.additem(x) endif endfor

endfor

Command2的Click事件代码: thisform.release

属性 caption caption 属性值 计算 关闭

实训任务3:创建一个浏览学生“成绩表”的表单。 实现方法: 对象 Form1 Label1 Label2 Label 3 Text1 Text2 Text 3 Command1 Command2 属性 caption caption caption caption controlsource controlsource controlsource caption caption 属性值 浏览学生成绩 学号 课程编号 成绩 表1.学号 表1.课程号 表1.成绩 上一条 下一条 关闭 Command3 caption Command1的Click事件代码: if.not.bof() skip-1

thisform.refresh()

endif

Command2的Click事件代码: if.not.eof() skip

thisform.refresh() endif

Command3的Click事件代码: thisform.release

实训任务二:

4、设计一个电话计费程序,表单窗口如图8.35所示,当单击“开始”则开始计时并显示开始时间,同时“开始”变为“结束”按钮,再单击“结束”,即结束通话并显示结束时间,同时“结束”变为“开始”按钮,单击“计费”则计算通话费并显示(假设每分钟通话费为0.15元)。 5、为第3题继续设计表单,要求再增加四个按钮:第一条、末一条、插入一条和删除一条。

6、输出“九九”乘法表,如图8.36所示。

7、设计一个查询表单如图8.37所示,当输入查询条件后,显示符合条件的“学生表”中的记录(可以进行模糊查询)。

实训任务4:设计一个电话计费程序,表单窗口如图8.35所示,当单击“开始”则开始计时并显示开始时间,同时“开始”变为“结束”按钮,再单击“结束”,即结束通话并显示结束时间,同时“结束”变为“开始”按钮,单击“计费”则计算通话费并显示(假设每分钟通话费为0.15元)。 实现方法: 对象 Form1 Label1 Label3 Label5 Label7 Label2 Label4 Label6 Label8 Command1 属性 caption caption caption caption caption caption caption caption caption caption 属性值 电话计费程序 开始时间 结束时间 通话时间 应付金额 开始 计费 Command2 caption 程序代码: Command1的Click事件代码: publ t1,t2

if this.caption=\"开始\" thisform.label5.caption='' thisform.label7.caption='' thisform.label9.caption='' thisform.label3.caption=time() this.caption=\"结束\"

thisform.command2.enabled=.f. t1=seconds() else

thisform.label5.caption=time() this.caption=\"开始\"

thisform.command2.enabled=.t. t2=seconds()

endif

Command2的Click事件代码: t=(t2-t1)/60 m=int(t) if t<>m m=m+1 endif

thisform.label7.caption=str(m,2)

thisform.label9.caption=str(0.15*m,5,2)

实训任务5:为第3题继续设计表单,要求再增加四个按钮:第一条、末一条、插入一条和删除一条。

实现方法: 对象 Form1 Label1 Label2 Label 3 Text1 Text2 Text 3 Command1 Command2 Command3 Command4 Command5 Command6 Command7 程序代码: if.not.bof()

skip-1

thisform.refresh() endif

Command2的Click事件代码: if.not.eof()

skip

thisform.refresh() endif

Command3的Click事件代码: thisform.release

Command4的Click事件代码: go top

thisform.refresh()

Command5的Click事件代码: go bott

thisform.refresh()

Command6的Click事件代码: insert

Command7的Click事件代码: dele pack

thisform.refresh()

属性 caption caption caption caption controlsource controlsource controlsource caption caption caption caption caption caption caption 属性值 浏览学生成绩 学号 课程编号 成绩 表1.学号 表1.课程号 表1.成绩 上一条 下一条 关闭 第一条 末一条 插入一条 删除一条 Command1的Click事件代码:

实训任务6:输出“九九”乘法表,如图8.36所示。 实现方法: 对象 Edit 1 Command1 属性 height width ReadOnly caption Command2 caption 程序代码: Command1的Click事件代码: thisform.edit1.value=\"*\"

for a=1to 9

thisform.edit1.value=thisform.edit1.value+\" \"+str(a,1) endfor

thisform.edit1.value=thisform.edit1.value+chr(13)

属性值 169 252 .T. 计算 关闭

for i=1 to 9

thisform.edit1.value=thisform.edit1.value+str(i,1)+\" \" for j=1 to i

thisform.edit1.value=thisform.edit1.value+str(i*j,2)+\" \" endfor

thisform.edit1.value=thisform.edit1.value+chr(13) endfor

Command2的Click事件代码: thisform.release

实训任务7:设计一个查询表单如图8.37所示,当输入查询条件后,显示符合条件的“学生表”中的记录(可以进行模糊查询)。 实现方法: 对象 Form1 Label1 Label2 Label3 Text1 Text2 Option1 Option2 Command1 程序代码: Command1的Click事件代码: use 表2

cxp1=thisform.optiongroup1.option1.value cxp2=thisform.optiongroup1.option2.value

属性 Caption caption caption caption value inputmask value inputmask caption caption caption 属性值 模糊查询 查询条件: 请输入学号: 请输入姓名: =space(6) 999999 =space(8) xxxxxxxx AND OR 查询

l1=thisform.text1.value l2=thisform.text2.value if l1=spac(6).and.l2=spac(8) thisform.release else

do case

case l1=spac(6)

set filt to 姓名=l2 case l2=spac(8)

set filt to 学号=l1

other

if cxp1=1

set filt to 姓名=l2.and.学号=l1 else

set filt to 姓名=l2.or.学号=l1 endi

endc coun to a if a=0

messagebox('没有你找的记录',48,'没找到') else brow endi endi

实训任务三:

将例9-1的“颜色”菜单改为“表单颜色”、“文本颜色”两个子菜单,其中又各含两种颜色,使得程序运行时可改变表单和文本的颜色。

实训任务8:将例9-1的“颜色”菜单改为“表单颜色”、“文本颜色”两个子菜单,其中又各含两种颜色,使得程序运行时可改变表单和文本的颜色。 实现方法: 菜单名称 文本字体 宋体 黑体 楷体 隶书 文本风格 粗体 斜体 下划线 颜色 文本颜色 红色 蓝色 表单颜色 红色 蓝色

结果 子菜单 命令 命令 命令 命令 子菜单 过程 过程 过程 子菜单 子菜单 过程 过程 子菜单 过程 过程 菜单级 菜单栏 文本字体 文本字体 文本字体 文本字体 菜单栏 文本风格 文本风格 文本风格 菜单栏 颜色 文本颜色 文本颜色 颜色 表单颜色 表单颜色

程序代码; 字体命令

_VFP.activeform.label1.fontname='宋体' _VFP.activeform.label1.fontname='黑体' _VFP.activeform.label1.fontname='楷体' _VFP.activeform.label1.fontname='隶书' 风格 粗体:

l=.not._VFP.activeform.label1.fontbold set mark of bar 1 of '文本风格'l _VFP.activeform.label1.fontbold=l 斜体

l=.not._VFP.activeform.label1.fontitalic set mark of bar 1of '文本风格'l _VFP.activeform.label1.fontitalic=l 下划线

l=.not._VFP.activeform.label1.fontunderline set mark of bar 1of '文本风格'l _VFP.activeform.label1.fontunderline=l 颜色修改命令: do case case bar()=1

_VFP.activeform.label1.forecolor=rgb(255,0,0) case bar()=2

_VFP.activeform.label1.forecolor=rgb(0,0,255) endc do case case bar()=1

_VFP.activeform.label1.backcolor=rgb(255,0,0) case bar()=2

_VFP.activeform.label1.backcolor=rgb(0,0,255) endc

Form1 的Init 事件代码: do 菜单1.mpr with this,.t. 对象 Label1

属性 caption 属性值 我的颜色可以改变

太原电力高等专科学校

课程设计报告书

设计题目 学生学籍管理系统 所属课程: 数据库原理与应用

系 别 管理工程系 专 业 行政管理专业 班 级 行政1118班 姓 名

霍英豪

指导教师 李雪梅

设计任务下达日期 2013年 1 月4 日 设计时间2013年1月14日 至 2013年1月18日

指 导 教 师 评 语

成绩评定: 指导教师签字: 年 月 日

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- yrrf.cn 版权所有 赣ICP备2024042794号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务