VB小程序制作Word下载.docx
《VB小程序制作Word下载.docx》由会员分享,可在线阅读,更多相关《VB小程序制作Word下载.docx(23页珍藏版)》请在冰豆网上搜索。
Command1
(1)
game
Command1
(2)
writeboard
Command1(3)
calculator
Command1(4)
byebye
Picture1
autoredraw
false
Label1
caption
Let'
sstartawonderfuljourney
表8-2Form2属性设置
Form2
输入个人资料窗口
Label11
name
Label12
gender
Label13
Isthatagirl?
Fream1
hobbies
command
okey
Option1
female
Value
True
默认被选中
Option2
male
Check1
WoW
Check2
LeagueofLegends
Check3
DungeonandFighter
Check4
QQspeed
Check5
films
Check6
movie
表8-3Form3属性设置
Form3
Command1
happiness
Command2
begin
Command3
love
Command4
beauty
Command5
laugh
scroes
Label2
Timer1
interval
500
Timer2
71
表8-4Form4属性设置
Form4
Label
路漫漫其修远兮
Label3
吾将上下而求索
TextBox
text
picture
返回
表8-5Form5属性设置
Form
Form5
Command1(0~9)
1~9,0
Command1(10)
.
Command2(0~4)
+-*/=
表8-6Form6属性设置
Form6
welcometousethissystemagain!
!
thankyou!
Timer1~12
1
Timer13
1000
4)编写代码。
编写“启动”窗体form1(Form1)中代码:
OptionExplicit
DimiAsInteger,ur1AsString,NAsInteger
PrivateSubCommand1_Click(IndexAsInteger)
N=Index
SelectCaseN
Case0
Form2.Show
Me.Hide
Case1
Form3.Show
Case2
Form4.Show
Case3
Form5.Show
Case5
Form6.Show
EndSelect
EndSub
PrivateSubForm_Activate()
Timer1.Enabled=True
PrivateSubForm_Load()
Me.Top=(Screen.Height-Me.Height)/2
Me.Left=(Screen.Width-Me.Width)/2
Picture2=LoadPicture("
C:
\Users\LQR\Desktop\VB.\1.gif"
)
Picture2.AutoRedraw=True
Picture2.PaintPicturePicture2.Picture,0,0,3000,3000,,,,,vbSrcCopy
PrivateSubTimer1_Timer()
OnErrorGoToErr
ur1="
\Users\LQR\Desktop\VB.\"
&
i&
"
.gif"
Picture2.Picture=LoadPicture(ur1)
i=i+1
ExitSub
Err:
i=1
编写“输入个人资料”窗体form2(Form2)中的代码:
PrivateSubCommand1_Click()
IfText1.Text="
"
Then
a=InputBox("
Youforgettoinputyourname?
"
Attention!
Yourname!
Ifa="
Ora="
ThenExitSub
Text1.Text=a
Else:
Form1.Show
Form2.Hide
EndIf
Picture1=LoadPicture("
\Users\LQR\Desktop\VB.\fei.jpg"
Picture1.AutoRedraw=True
Picture1.PaintPicturePicture1.Picture,0,0,3750,4900,,,,,vbSrcCopy
编写“GAME”窗体form3(Form3)中的代码:
DimaAsInteger,iAsInteger,ur1AsString
IfCommand1.BackColor=RGB(225,0,0)Then
Label2=Val(Label2.Caption)+1
PrivateSubCommand2_Click()
PrivateSubCommand3_Click()
IfCommand3.BackColor=RGB(225,0,0)Then
PrivateSubCommand4_Click()
IfCommand4.BackColor=RGB(225,0,0)Then
PrivateSubCommand5_Click()
IfCommand5.BackColor=RGB(225,0,0)Then
PrivateSubcw_Click()
Label2="
PrivateSubTimer2_Timer()
\Users\LQR\Desktop\新建文件夹.\"
.jpg"
Picture1.Picture=LoadPicture(ur1)
Picture1.PaintPicturePicture1.Picture,0,0,12135,8295,,,,,vbSrcCopy
i=45
\Users\LQR\Desktop\新建文件夹.\45.jpg"
StaticxAsInteger
a=Int(Rnd()*4)
SelectCasea
Command1.BackColor=RGB(225,0,0)
Command3.BackColor=RGB(15,0,0)
Command4.BackColor=RGB(15,0,0)
Command5.BackColor=RGB(15,0,0)
Command3.BackColor=RGB(225,0,0)
Command1.BackColor=RGB(15,0,0)
Command4.BackColor=RGB(225,0,0)
Command5.BackColor=RGB(225,0,0)
Ifx<
50Then
x=x+1
Else
Timer1.Enabled=False
Command5.BackColor=RGB(15,0,0)
Command1.BackColor=RGB(15,0,0)
Command3.BackColor=RGB(15,0,0)
Command4.BackColor=RGB(15,0,0)
x=0
EndIf
PrivateSubtui_Click()
Form1.Show
PrivateSubwf_Click()
MsgBox"
rules:
Chr(13)&
Hitthedifferentcolor.Inthefixedtime,morehits,morescores!
!
vbOKOnly,"
Rule"
编写“writeboard”窗体form4(Form4)中的代码:
PrivateSubN_Click()
Text1.Text="
PrivateSubO_Click()
CommonDialog1.Filter="
所有文件(*.*)|*.*|文本文件(*.TXT)|*.txt"
CommonDialog1.FilterIndex=1
CommonDialog1.ShowOpen
Text1.Text=CommonDialog1.FileName
PrivateSubS_Click()
CommonDialog1.ShowSave
PrivateSubT_Click()
PrivateSubText1_Change()
Text1.Text=Text1.Text
PrivateSubY_Click()
CommonDialog1.ShowColor
Text1.ForeColor=CommonDialog1.Color
PrivateSubZ_Click()
CommonDialog1.Flags=3Or256
CommonDialog1.ShowFont
WithText1
.FontName=CommonDialog1.FontName
.FontSize=CommonDialog1.FontSize
.FontStrikethru=CommonDialog1.FontStrikethru
.FontBold=CommonDialog1.FontBold
.FontItalic=CommonDialog1.FontItalic
.FontUnderline=CommonDialog1.FontUnderline
.ForeColor=CommonDialog1.Color
EndWith
\Users\LQR\Desktop\VB.\qu.jpg"
Picture1.PaintPicturePicture1.Picture,0,0,1500,2500,,,,,vbSrcCopy
编写“calculator”窗体form5(Form5)中的代码:
DimvAsBoolean
DimSAsInteger
DimxAsDouble
DimYAsDouble
IfForm5.Tag="
T"
IfIndex=10Then
0"
Else
Text1.Text=Command1(Index).Caption
Form5.Tag="
Text1.Text=Text1.Text&
Command1(Index).Caption
PrivateSubCommand2_Click(IndexAsInteger)
IfvThen
x=Val(Text1.Text)
v=Notv
Y=Val(Text1.Text)
SelectCaseS
Text1.Text=x+Y
Text1.Text=x-Y
Text1.Text=x*Y
IfY<
>
0Then
Text1.Text=x/Y
傻了?
不能以0为除数啊!
提示"
Text1.Text=x
v=False
Case4
Y=0
S=Index
PrivateSubxin_Click()
编写结束窗体form6(Form6)中的代码:
DimxAsInteger,YAsInteger,aAsInteger,mAsLong,NAsLong
Timer3.Enabled=True
Timer5.Enabled=True
Timer7.Enabled=True
Timer9.Enabled=True
Timer11.Enabled=True
\Users\LQR\Desktop\VB.\qwe.jpg"
Picture1.PaintPicturePicture1.Picture,0,0,2250,2250,,,,,vbSrcCopy
Picture2.PaintPicturePicture2.Picture,0,0,2250,2250,,,,,vbSrcCopy
Picture3=LoadPicture("
Picture3.AutoRedraw=True
Picture3.PaintPicturePicture3.Picture,0,0,2250,2250,,,,,vbSrcCopy
IfPicture1.Width+Picture1.Left>
=Me.ScaleWidthThen
Timer2.Enabled=True
Timer1.Enabled=False
Picture1.Left=Picture1.Left+50
IfPicture1.Left<
=0Then
Timer2.Enabled=False
Picture1.Left=Picture1.Left-50
PrivateSubTimer3_Timer()
IfPicture1.Top+Picture1.Height>
6700Then
Timer4.Enabled=True
Timer3.Enabled=False
Picture1.Top=Picture1.Top+50
PrivateSubTimer4_Timer()
If