操作题控件圆柱表面积、元旦倒计时高考毛毛虫密码设计显示小时_第1页
操作题控件圆柱表面积、元旦倒计时高考毛毛虫密码设计显示小时_第2页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、圆柱表面积、元旦倒计时、高考倒计时、毛毛虫灵,图像的设置,移动图像设计、显示小时、分钟、秒,跳动的精编写一个计时程序。*界面要求: *运行要求: *使用、命令按钮、时钟控件完成。1、点击“开始”按钮,显示 0 并开始计时,每隔一秒,中显示的秒数加 1;*2、点击“结束”按钮,停止计时。Dim t AsPrivate Subegerd1_Click()Timer1.Enabled = True t = 0Timer1.erval = 1000End SubPrivate Subd2_Click()Timer1.Enabled = False End SubPrivate Sub Timer1_T

2、imer() t = t + 1Label1.Caption = t圆柱表面积编写一个计算圆柱体表面积的程序,如图 K_514.jpg 所示。 * 界面要求: *使用、根据文本框、命令按钮完成。 * 运行要求: *窗体标题为“计算圆柱体表面积”; *用户输入的半径、高,单击“表面积”按钮,将圆柱体表面积显示到中; *如果表面积50,则使用 msgbox 显示“小”, * 如果 50=表面积=100,则使用 msgbox 显示“大”。 * 注:按照 3.14 计算。 *(此题要求上载窗体文件,不要求填写程序运行结果)r = Val(Text1.Text) h = Val(Text2.Text)s

3、 = 3.14 * r 2 * 2 + 2 * 3.14 * r * h Label1.Caption = sIf s = 50 And s = 100 Then MsgBox (大)元旦倒计时Private Sub Form_Load() Timer1.erval = 1000 End SubPrivate Sub Timer1_Timer()i = CDate(Year(Date) + 1 & -1-1) - Now ClsPr距离 & Year(Date) + 1 & 年元旦还有: &(i) & 天 & Format(i -(i), HH:MM:SS)End Sub高考倒计时Privat

4、e Sub Form_Load() Form1.Caption = 高考倒计时 Label1.Caption = 今天是: Label1.AutoSize = True Label1.FontName = 黑体 Label1.FontSize = 20 Label1.FontName = 黑体Label2.Caption = 距离奥运会还有Label2.AutoSize = True Label2.FontSize = 20 Label2.FontName = 黑体 Label4.Caption = 天 Label4.AutoSize = True Label4.FontSize = 20 L

5、abel4.FontName = 黑体 Label3.Caption = Label3.AutoSize = True Label3.FontSize = 20Label3.BorderStyle = 1 Label3.BackColor = vbYellow Label3.ForeColor = vbRed Timer1.erval = 1000End SubPrivate Sub Timer1_Timer() Text1.Text = Format(Date, dddddd)Label3 = DateDiff(d, Now, #6/7/2011#)End Sub毛毛虫Private Sub

6、设计d1_Click()If Text1.Text = 毛毛虫 And Text2.Text = 12345678 ThenLabel1 = ! + Text1Label2.Visible = False Label3.Visible = False Text1.Visible = False Text2.Visible = Falsed1.Visible = False d2.Visible = FalseImage1.Enabled = TrueImage1.Stretch = True Image1.Picture = Lo ElseLabel1 = 用户名或icture(d:5_副本.

7、jpg)错误!请重新登录。Label1.ForeColor = vbRed Text1.Text = Text2.Text = Text1.SetFocus End IfEnd SubPrivate Sub EndEnd Subd2_Click()Private Sub Form_Load()Form1.Caption = 天地用户登录Label1.Caption = 欢迎来到 Label1.Alignment = 2 - center Label1.FontName = 黑体 Label1.FontSize = 20 Label2.Caption = 用户名: Label2.AutoSize

8、 = True Label2.FontSize = 20Label2.FontName = 宋体天地!世界Label3.Caption = Label3.AutoSize = True Label3.FontSize = 20:Label3.FontName = 宋体d1.Caption = 登录 d2.Caption = 取消Text1.Text = Text2.Text = Text2.MaxLength = 8 Text2.PasswordChar = * Image1.Enabled = FalseEnd Sub显示小时、分钟、秒在上显示小时、分钟、秒Private Sub Form_

9、Load() Label1.FontName = 黑体 Label1.FontSize = 48Timer1.erval = 1000End SubPrivate Sub Timer1_Timer() Label1.Caption = TimeEnd Sub在文本框中输入小时、分钟、秒,计算总秒数然后输出Private Subd1_Click()eger, m Aseger, s Aseger egerDim Dimh Asx Ash m s x=Val(Text1.Text) Val(Text2.Text) Val(Text3.Text)h * 3600 + m * 60+ sLabel2.

10、Caption = 共计秒数 & Str(x) & 秒 End Sub跳动的精灵利用一个时钟控件和一个颜色随即改变。Private Sub Form_Load()制作出一个模拟的动画效果,使文字在窗体内任意挑动,Label1.Caption = 跳动的心灵 Label1.Font = 隶书 Label1.FontSize = 20 Label1.FontBold = True Label1.AutoSize = True Label1.BackStyle = 0Timer1.erval = 500End SubPrivate Sub Timer1_Timer()Dim zLabel1.Left

11、 =Label1.Top =(Rnd * (Form1.ScaleWidth - Label1.Width)(Rnd * (Form1.ScaleHeight - Label1.Height)z =(Rnd * 6 + 1)Label1.ForeColor = Choose(z, vbRed, vbYellow, vbGreen, vbBlue, vbWhite, vbBlack)End Sub图像的设置在窗体上添加 1 个框、1 个文本框、1 个命令按钮和 1 个。当输令为“abc”时,框中显示一幅完整的,否则不显示。Private Subd1_Click()If Text1.Text =

12、abc ThenPicture1.Picture = LoElseicture(d:5_副本.jpg)Picture1.Picture = Lo End IfEnd Subicture()Private Sub Form_Load() Label1.Caption = 请输入: Label1.Font = 宋体 Label1.FontSize = 20 Label1.FontBold = True Text1.Text = Text1.PasswordChar = *d1.Caption = 确定Picture1.AutoSize = True End Sub移动图像“移动的”在窗体上添加一个时钟、一个图像控件(image1)(其中 stretch 属性为 ture)和两个命令按钮“移动”、“停止”。程序运行后,单击“移动”按钮图像将在窗体内随机移动位置,单击“停止”按钮将停止移动。Private Subd1_Click()Timer1.erval = 1000End SubPrivate Sub Timer1.erval = 0End Subd2_Click()Private Sub

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论