这是一个时钟都源程序,给你了
Dim pi As Single, p As Boolean, kk As Integer, aa As String
Dim s As Single, h As Single, m As Single, baoshi As String
Dim i As Integer, st As Boolean, j As Integer, ss As String
Dim week As String
Private Sub Command1_Click(Index As Integer)
Dim bool As Boolean
bool = False
Select Case Index
Case 0
p = Not (p)
Dim ppp As Integer
For ppp = 3 To 7
Command1(ppp)Visible = p
Next
Case 1
End
Case 2
Label1Visible = True
Label2Visible = True
Label3Visible = True
Text1Visible = True
Text2Visible = True
Text3Visible = True
Command3Visible = True
Command4Visible = True
Text1SetFocus
Text1Text = ""
Case 3
If i = 0 Then
If j = 0 Then j = kk
j = j - 1
Dir1Path = ss
Dir1Path = Dir1List(j)
i = File1ListCount
End If
i = i - 1
bool = True
Case 4
st = Not (st)
Case 5
If i = File1ListCount - 1 Then
If j = kk - 1 Then j = -1
j = j + 1
Dir1Path = ss
Dir1Path = Dir1List(j)
i = -1
End If
i = i + 1
bool = True
Case 6
If j = 0 Then j = kk
j = j - 1
Dir1Path = ss
Dir1Path = Dir1List(j)
i = 0
bool = True
Case 7
If j = kk - 1 Then j = -1
j = j + 1
Dir1Path = ss
Dir1Path = Dir1List(j)
i = 0
bool = True
End Select
If bool Then
Call display(i)
bool = False
End If
s = Second(Time)
h = Hour(Time)
m = Minute(Time)
DrawWidth = 1
Form1Line (1320, 1320)-(1100 Sin(s 2 pi / 60) + 1320, (-1) 1100 Cos(s 2 pi / 60) + 1320), RGB(256, 0, 0)
mm = m + s / 60
DrawWidth = 2
Form1Line (1320, 1320)-(950 Sin(mm 2 pi / 60) + 1320, (-1) 950 Cos(mm 2 pi / 60) + 1320), RGB(0, 256, 0)
hh = h + m / 60
DrawWidth = 3
Form1Line (1320, 1320)-(720 Sin(hh 2 pi / 12) + 1320, (-1) 720 Cos(hh 2 pi / 12) + 1320), RGB(0, 0, 256)
CurrentX = 1000
CurrentY = 1760
Print Time
CurrentX = 1100
CurrentY = 1960
Print week
CurrentX = 1000
CurrentY = 2160
Print Date
End Sub
Private Sub Command2_Click()
WindowsMediaPlayer1Close
Command2Visible = False
End Sub
Private Sub Command3_Click()
baoshi = Text1Text & Text2Text & Text3Text
Label1Visible = False
Label2Visible = False
Label3Visible = False
Text1Visible = False
Text2Visible = False
Text3Visible = False
Command4Visible = False
Command3Visible = False
End Sub
Private Sub Command4_Click()
Command4Visible = False
Command3Value = True
baoshi = ""
End Sub
Private Sub Dir1_Change()
File1Path = Dir1Path
End Sub
Private Sub Form_DblClick()
Dim k As Integer
If p = False Then
k = 2
Else
k = 7
End If
For Index = 0 To k
Command1(Index)Visible = Not (Command1(Index)Visible)
Next
End Sub
Private Sub Form_Load()
Form1Left = ScreenWidth - 2650
Form1Top = 0
pi = 31415926
st = False
p = True
bashi = ""
i = 0
j = 0
ss = ("C:\Documents and Settings\user\My Documents\My picture\")
Dir1Path = ss
kk = Dir1ListCount
File1Pattern = ""
File1Path = Dir1Path
Dir1Path = Dir1List(j)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2SetFocus
Text2Text = ""
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3SetFocus
Text3Text = ""
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command3SetFocus
End If
End Sub
Private Sub Timer1_Timer()
Select Case Weekday(Date)
Case 1
week = "星期日"
Case 2
week = "星期一"
Case 3
week = "星期二"
Case 4
week = "星期三"
Case 5
week = "星期四"
Case 6
week = "星期五"
Case 7
week = "星期六"
End Select
If h & m & s = baoshi Then
Command2Visible = True
WindowsMediaPlayer1Visible = False
WindowsMediaPlayer1URL = ("C:\Documents and Settings\user\My Documents\My Music\11mp3")
End If
If st = True Then
If p = False Then
Form1Picture = LoadPicture("C:\Documents and Settings\user\My Documents\My picture\display\11jpg")
Else
Form1PaintPicture LoadPicture(aa), 0, 0, Form1Height, Form1Width
End If
Else
If p = False Then
Form1Picture = LoadPicture("C:\Documents and Settings\user\My Documents\My picture\display\11jpg")
Else
If i = File1ListCount - 1 Then
If j = kk - 1 Then j = -1
j = j + 1
Dir1Path = ss
Dir1Path = Dir1List(j)
i = -1
End If
i = i + 1
filname1 = File1List(i)
filname = File1Path & "\" & filname1
aa = filname
Form1PaintPicture LoadPicture(filname), 0, 0, Form1Height, Form1Width
End If
End If
CurrentX = 1000
CurrentY = 1760
Print Time
CurrentX = 1100
CurrentY = 1960
Print week
CurrentX = 1000
CurrentY = 2160
Print Date
s = Second(Time)
h = Hour(Time)
m = Minute(Time)
DrawWidth = 1
Form1Line (1320, 1320)-(1100 Sin(s 2 pi / 60) + 1320, (-1) 1100 Cos(s 2 pi / 60) + 1320), RGB(256, 0, 0)
mm = m + s / 60
DrawWidth = 2
Form1Line (1320, 1320)-(950 Sin(mm 2 pi / 60) + 1320, (-1) 950 Cos(mm 2 pi / 60) + 1320), RGB(0, 256, 0)
hh = h + m / 60
DrawWidth = 3
Form1Line (1320, 1320)-(720 Sin(hh 2 pi / 12) + 1320, (-1) 720 Cos(hh 2 pi / 12) + 1320), RGB(0, 0, 256)
End Sub
Private Sub Timer2_Timer()
Dim X As Single, Y As Single, nn As Integer, z As Integer
z = 12
For nn = 0 To 354 Step 6
X = 1100 Sin(nn pi / 180) + 1320
Y = (-1) 1100 Cos(nn pi / 180) + 1320
If nn Mod 5 = 0 Then
DrawWidth = 8
CurrentX = X
CurrentY = Y
If z = 13 Then z = 1
Print z
z = z + 1
Else
DrawWidth = 4
End If
Randomize
If p = False Then
PSet (X, Y), RGB(256, 0, 0)
Else
PSet (X, Y), RGB(Int(Rnd 256), Int(Rnd 256), Int(Rnd 256))
End If
DrawWidth = 8
PSet (1320, 1320), RGB(256, 256, 256)
Next
End Sub
Public Sub display(dd As Integer)
filname1 = File1List(dd)
filname = File1Path & "\" & filname1
aa = filname
Form1PaintPicture LoadPicture(filname), 0, 0, Form1Height, Form1Width
End Sub
“VB里的控件就是对象”这句话是对的,但是后面半句“对象可看作是窗体或控件”是错的。
从先前编过的多媒体程可以看出,编VB程序首先要创建一个 良好的可视化界面。整个程序界面是由窗体(Form)和一些必要的控件元素(Control) 构成的。于VB属于面向对象编程,所以一般将窗体与控件都称为对象。
窗体是VB中最基本的对象,是应用程序的基本组成部分,是菜单栏、工具栏和控件等对象的容器,是应用程序与用户交互的窗口或对话框。窗体设计是整个VB应用程序设计的基础。一个窗体对应一个代码模块。
扩展资料
窗体设计分类:
(1)单窗体设计:应用程序中只包含一个窗体,即单文档窗体。
(2)多重窗体设计:应用程序中包含多个窗体,即多个单文档窗体。
(3)多文档窗体(MDI)设计:一种特殊的多窗体界面,应用程序中包含一个父窗体和多个子窗体。
窗体常用属性:
(1)Name(名称):窗体名称,默认值为Form1、Form2、……。只能在设计阶段通过属性窗口改变,运行时不能更改。
(2)Caption(标题):在窗体的标题栏中显示的标题,默认值为Form1、Form2、……。
窗体的属性决定窗体的外观和 *** 作。可以通过属性窗口、程序代码、鼠标拖动来设置窗体属性。名称(Name)属性与Caption属性有本质区别。Caption属性的值显示在标题栏中,而名称(Name)属性是一个标识,用于区别其他对象,在代码中标识对象。
在设计状态下,窗体和控件的Name属性值可以由编程人员设置,这就是对窗体或控件的命名,命名必需使用合法的用户标识符。
以上就是关于求vb课题!!!急,好的有追加分!!!把程序代码发上来!跪求!!!各位神级大仙各显神通吧~~~跪求~全部的内容,包括:求vb课题!!!急,好的有追加分!!!把程序代码发上来!跪求!!!各位神级大仙各显神通吧~~~跪求~、VB里的控件就是对象,对象可看作是窗体或控件,我说的对吗、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)