用vb程序设计一个电子时钟

作者&投稿:有些 (若有异议请与网页底部的电邮联系)
VB程序设计怎么做数字时钟~

1、添加一个“label控件”命名为label2、添加一个“timer控件”命名为timer13、设置“timer1”的“Interval属性”为1000使用到的代码:
Dim Hour As Integer '小时Dim Min As Integer '分钟Dim Sec As Integer '秒Private Sub Form_Load() Hour = 0 Min = 0 Sec = 0 Label1.Caption = "00 : 00 : 00"End SubPrivate Sub Timer1_Timer() Dim strHour As String Dim strMin As String Dim strSec As String Sec = Sec + 1 If Sec >= 60 Then Sec = 0 Min = Min + 1 If Min >= 60 Then Min = 0 Hour = Hour + 1 If Hour >= 24 Then Hour = 0 End If End If End If If Hour < 10 Then strHour = "0" & Hour Else strHour = Hour End If If Min < 10 Then strMin = "0" & Min Else strMin = Min End If If Sec < 10 Then strSec = "0" & Sec Else strSec = Sec End If Label1.Caption = strHour & " : " & strMin & " : " & strSecEnd Sub

label字体什么的自己改吧,主要功能实现了
private
sub
form_load()
timer1.enabled
=
true
timer1.interval
=
1000
timer2.enabled
=
false
timer2.interval
=
500
end
sub
private
sub
timer1_timer()
label1.caption
=
time
end
sub
private
sub
text1_keydown(keycode
as
integer,
shift
as
integer)
if
keycode
=
13
then
if
not
isdate(text1.text)
then
msgbox
"时间格式错误,正确应为hh:mm:ss"
else
text1.locked
=
true
timer2.enabled
=
true
end
if
end
if
end
sub
private
sub
timer2_timer()
dim
ltime
as
integer
static
lblcolor
as
boolean
ltime
=
datediff("s",
time,
text1.text)
if
ltime
<=
0
then
if
lblcolor
=
true
then
label1.backcolor
=
vbred
lblcolor
=
false
else
label1.backcolor
=
vbwhite
lblcolor
=
true
end
if
end
if
end
sub

label字体什么的自己改吧,主要功能实现了
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
Timer2.Enabled = False
Timer2.Interval = 500

End Sub

Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Not IsDate(Text1.Text) Then
MsgBox "时间格式错误,正确应为HH:MM:SS"
Else
Text1.Locked = True
Timer2.Enabled = True
End If
End If
End Sub

Private Sub Timer2_Timer()
Dim lTime As Integer
Static LblColor As Boolean
lTime = DateDiff("s", Time, Text1.Text)
If lTime <= 0 Then
If LblColor = True Then
Label1.BackColor = vbRed
LblColor = False
Else
Label1.BackColor = vbWhite
LblColor = True
End If
End If
End Sub


用VB写一个程序,控制一个现实中的电路开关,求最经济方案
最简单的就是用串口,当发送开或关的命令时cts,rts应该有电平的变化(0到1),利用这个变化加上驱动电路,接继电器实现电路开关.

电风扇摇头 的vb程序设计,请大家帮个帮设计下,不胜感激!!
程序中:例如有一张电扇旋转的图片,首先向左移动(按像素累加),当超过设定的左侧位置竖线时(例如100px),此时开始反向(旋转)累加像素,即向右移动,当超过设定的右侧位置竖线时(例如-100px),再反向累加像素。循环。在这里两侧竖线的含义有两种,你可以分别考虑。第一种,是以图片为0px基准,像...

VB程序设计 产生一个一维数组A(20),以四行五列的形式输出
For i = 1 To 20 A(i) = Int(Rnd * 100 + 1)Print A(i),If i Mod 5 = 0 Then Print Next i End Sub 方法二:Private Sub Form_click()Dim A(1 To 20) As Integer For i = 1 To 20 A(i) = Int(Rnd * 100 + 1)Print Tab(8 * n + 2); A(i);n = n + 1 ...

VB:如何使一个程序只运行一个
设计时把窗体的LinkMode设为1-Source;在窗体上添加一个PictureBox命名picDDE。(貌似文本框和标签也可以这么用,没试过)'API函数,用于把制定窗口设为活动窗口 Private Declare Function SetActiveWindow Lib "user32" (ByVal hwnd As Long) As Long Private Const sMsgToTop As String = "ToTop!"...

vb程序设计是什么
对特定的问题进行分析,并设计出解题的算法,根据得到的算法,用VB语言编写出源程序的过程就是vb程序设计。VB是微软公司开发的一种通用的基于对象的程序设计语言,为结构化的、模块化的、面向对象的、包含协助开发环境的事件驱动为机制的可视化程序设计语言。是一种可用于微软自家产品开发的语言。

如何用vb程序设计一个公用电话计费的程序?我要步骤啊!
a=inputbox("请输入时间","提示")if a="" then exit sub b=iif(a<3,0.5,(a-3)*0.15+0.5)if hour(time)<7 or hour(time)>19 then b=b\/2 msgbox "话费为:" & b

急 求懂VB程序的 帮我 编写以下程序 谢谢 是电子摇奖机的 一个程序
取名:Lab 添加一个Timer控件,取名:Timer1,每200毫秒执行一次。Private sub timer1_timer()Lab.caption = rnd() * 100 end sub Private sub command1_click()if comm.caption = "开始" then comm.caption = "停止"print lab.caption else comm.caption = "开始"end if end sub ...

vb 制作一个小程序,标题栏带有问号按钮,怎么点击这个按钮进入我设计的窗...
1、首先,双击窗体空白处进copy入代码窗口。2、然后我们在事件中找到百Click事件。3、这个度时候开始编写代码测试【问Print "我是Click单击答属性!"】。4、然我们开始运行测试。5、启动后,我们在窗体空白处单击。6、这个时候我们将可以看到测试的效果。

VB:设计如图的VB程序,实现公用电话收费功能。代码直接写在下面,谢啦...
Sub Command1_Click()dim tmp as string tmp = Format(Now,"hh:mm:ss")Text1.Text = tmp HH = Var(Left(tmp,2))SS = Var(Right(tmp,2))MM= Var(Mid(tmp,4,2))End Sub '''结束通话 Sub Command2_Click()dim tmp as string Dim tm as double tmp = Format(Now,"hh:mm:ss")...

用VB按以下要求制作一个程序:设计一个窗体,用InputBox函数输入一个自 ...
Private Sub Command1_Click()Dim n, i, S As Long n = InputBox("请输入自然数n的值", "期末考试第一题")For i = 1 To n Step 2 S = i + i Next Label1.Caption = "1到" & n & "之间奇数的和为:" & S End Sub Private Sub Command2_Click()Unload Me End Sub 窗体中...

安达市15614425327: 用vb程序设计一个电子时钟 -
亓寿槐角: label字体什么的自己改吧,主要功能实现了 Private Sub Form_Load() Timer1.Enabled = True Timer1.Interval = 1000 Timer2.Enabled = False Timer2.Interval = 500 End Sub Private Sub Timer1_Timer() Label1.Caption = Time End Sub Private Sub ...

安达市15614425327: 怎么在vb中制作一个时钟、显示日期及时间、谁知道? 情写下所需控件名、和代码、 -
亓寿槐角: 非常简单: 添加1个标签:Label1,1个时钟控件:Timer1 代码: Private Sub Form_Load() Timer1.Interval = 1000 End SubPrivate Sub Timer1_Timer() Label1.Caption = Now End Sub

安达市15614425327: 求 VB编写电子钟 -
亓寿槐角: 在窗体中加一个Timer控件就行了.Const PI = 3.1415926 Private Sub Form_Load() Scale (-100, 100)-(100, -100) Timer1.Interval = 1000 Form1.BackColor = &HFFFFFF Timer1_Timer Form1.Show Form1.Refresh Call Timer1_Timer End Sub ...

安达市15614425327: 用VB编写电子时钟
亓寿槐角: '几句代码就可以搞定 '在窗体添加控件:Timer1、Label1 Private Sub Form_Load() Timer1.Interval = 500: Timer1.Enabled = True Label1.Font.Size = 48: Label1.AutoSize = True End Sub Private Sub Timer1_Timer() Label1.Caption = Format(Now, "hh:mm:ss") End Sub

安达市15614425327: 怎么用VB做时钟? -
亓寿槐角: 用一个Timer 设置Interval 为1000,然后在Timer事件中写代码,对某一个Label控件的Caption属性进行赋值,Format(Time,"HH:mm:ss") 至于毫秒,真有必要吗?..

安达市15614425327: VB 编制一个电子时钟程序 -
亓寿槐角: 指针式的简单 还用说吗 直接用TIMER控件 控制时间 用line画线就行 太简单了不说了 led的 用图片做一下就行了也不太难

安达市15614425327: vb编程怎么实现这个时钟 -
亓寿槐角: Private Sub Form_Load() Label1.Caption = "电子时钟" Label2.Caption = "" Label3.Caption = "时" Label4.Caption = "" Label5.Caption = "分" Label6.Caption = "" Label7.Caption = "秒" Command1.Caption = "退出" Timer1....

安达市15614425327: 用VB制作电子时钟 有表盘 有时针分针的 有数字 -
亓寿槐角: 'Option Explicit '添加 Line1 Line2 Line3 Timer1 Dim xx1%, yy1% '宣告变量xx1,yy1为整型(给圆心用的) Private Sub Form_Load() Me.AutoRedraw = True '重画为真 '窗体置中 Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) ...

安达市15614425327: VB程序关于如何画一个时钟并显示精确的时间的编程代码? -
亓寿槐角: 画个label timer 设置 timer的时间间隔为1000 在timer事件中写入label.caption=now

安达市15614425327: 求一个VB时钟代码 -
亓寿槐角: Dim graphics As Long Dim pen As Long Private Sub Form_Load()InitGDIPlusGdipCreateFromHDC Me.hDC, graphicsGdipCreatePen1 &HFFFF0000, 1, UnitPixel, pen End Sub'画针.x,y原点,r半径t时刻(1-60) Private Sub DrawLine(x As ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网