【精品】VB程序设计基础申石磊答案.doc

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

河南大学09级VB程序设计课后习

参考答案(编码)
2- 1
Private Sub Form_Click()
CIs
End Sub
Private Sub Form_DblClick()
FontSize = 40
FontName ="隶书"
ForeColor = vbRed
Print ”热烈庆祝”
FontSize = 60
FontName ="宋体"
ForeColor = vbGree n
Print "河南大学运动会召开”
End Sub
2-2
Private Sub Command1_Click()
Label 1 .Move Width * Rnd, Height * Rnd
End Sub
2-3
Private Sub Command1_Click()
Label 1 .Visible = True
End Sub
Private Sub Command2_Click()
Label 1 .Visible = False
End Sub
2- 4
Private Sub Timer1_Timer()
Text 1 .Text = Now
Caption = Textl.Text
End Sub
2- 5
Private Sub Timer1_Timer()
If BackColor = vbRed Then
BackColor = vbYellow
Else
BackColor = vbRed
End If
End Sub
2-6
Private Sub Timer1_Timer()
If Label 1 .Left < Forml .Width Then
Label 1 .Left = Label 1 .Left + 200
Else
Label 1 .Left = -L abell .Left
End If
End Sub
Private Sub Command1_Click()
Textl .Visible = True
End Sub
Private Sub Command2_Click()
Textl .Visible = False
End Sub
2- 8
Private Sub Textl_Change()
Text2.Text = Textl .Text
End Sub
2-9
Private Sub Command1_Click()
FontSize = 20
FontBold = True
Print ”欢迎来到"
Print ”河南大学"
End Sub
Private Sub Command2_Click()
CIs
End Sub
Private Sub Command3_Click()
End
End Sub
2-10
Private Sub Command1_Click() r =
Textl .Text
Text2.Text = 3.14 * 2 * r
End Sub
Private Sub Command2_Click()
Textl .Text =""
Text2.Text =""
Textl ・ SetFocus
End Sub
2-11
Private Sub Form_Load()
Textl .Text ="河南大学欢迎您!"
Textl .FontName ="宋体"
Textl .FontSize = 50
Textl .BackColor = vbYellow
Textl .ForeColor = vbBlue
End Sub
2-12
Dim s As String
Private Sub Command1_Click()
s = Textl .SelText
End Sub
Private Sub Command2_Click()
Text2.SelText = s
End Sub
2- 13
Private Sub Timer1_Timer()
If Label 1 .Top > -Labell.Height Then
Labell.Top = Label 1.Top - 100
Else
Label 1 ・ Top = Forml ・H eight
End If
End Sub
3- 2
Private Sub Form_Click()
Dim n As Integer
Randomize
n = lnt((90*Rnd) + 10)
Print n
End Sub
3- 3
Private Sub Timer1_Timer()
CIs
Print ”河南大学环境与规划学院"
FontSize = lnt(71 * Rnd + 10)
End Sub
3- 4
Private Sub Command1_Click()
n = Textl .Text
Text2.Text = Hex(Asc(Right(Text1 .Text, 1)))
End Sub
Private Sub Command2_Click()
Textl .Text =""
Text2.Text =""
Textl ・ SetFocus
End Sub
3-5
Private Sub Commandl Click()
Dim m As Date
m = Textl.Text
n = Date
Text2.Text = n - m
End Sub
Private Sub Command2_Click()
Textl .Text =""
Text2.Text =""
Textl ・ SetFocus
End Sub
3- 6
Dim b As String
Dim n As String
Dim m As String
Private Sub Command1_Click()
m = Left(Text1, 1)
n = Right(Text1, 1)
b = Mid(Text1,2, 1)
Text2.Text = n & b & m
End Sub
Private Sub Command2_Click()
Textl .Text =,m
Text2.Text =""
Textl.SetFocus
End Sub
3-7
Private Sub Form_click()
r = lnputBox("请输入字符”)
Print Left(r, 1) & Mid(r, 3,1) & Right(r, 1)
End Sub
3-
Private Sub Timer1_Timer()
Label 1 .FontSize = Rnd *40 + 10
Label 1 .BackColor = RGB(Rnd * 256, Rnd * 256,
Rnd * 256)
Label 1 .ForeColor = QBColor(lnt(16 * Rnd))
End Sub
3-10
Private Sub Form_Click()
r! = lnputBox("请输入您的工资:”)
a = r\ 100
b = (r-100*a)\50
c = (r-100*a-b*50)\10
d = (r-100*a-b*50-c*10)\5
e = (r - 100*a-b*50-c* 10-d*5)\2
f = r- 100*a-b*50-c* 10-d*5-e*2
Print"您的工资是:” &r
Print "100 元张数:”&a
Print f,50元张数:” & b
Print "10 元张数:"&c
Print"5元张数:"&d
Print H2元张数:” & e
Print H1 元张数:“&f
End Sub
Private Sub Command1_Click() Dim p As Single, r As Single, n As Single
p = Textl
r = T ext2
n = T ext3
s = p * (1 + r) A n
Msg Box "您的本息是:"& Round(s, 2)
End Sub
4- 2
Private Sub Form_click()
Dim max As Single, min As Single
a! = InputBoxf"请输入第一个实数”)
b! = lnputBox("请输入第二个实数”)
If a > b Then
Print a, b
Else
Print b, a
End If
End Sub
4- 3
Private Sub Form_click()
Cis
a! = lnputBox("请输入年份")
If a Mod 4 = 0 And a Mod 100 <> 0 & a Mod 400 =
0 Then
Print "您刚刚输入的年份为闰年!”
Else
Print ”您刚刚输入的年份不是闰年!”
End If
End Sub
4- 4
Private Sub Form_click()
a! = lnputBox("a=")
b! = lnputBox("b=")
c! = lnputBox("c=")
d!=b*b-4*a*c
If d >= 0 Then
m! = (-b + Sqr(d)) / (2 * a)
n! = (-b-Sqr(d))/(2*a)
Print" X1 = n; m, ”X2="; n
Else
r = (-b) / (2 * a)
i = Sqr(Abs(-d)) / (2 * a)
Print M X1 ="; r & & Abs(i) & "i","X2 = "; r &
& Abs(i) & T
End If
End Sub
4- 5
Private Sub Command1_Click()
Dim x!
x = Textl
If x < 60 Then Text2 = "S 考!" Elself x < 70 Then Text2 = * 吸格!"
Elself x < 0 Then
Text2 = M中等!”
Elself x < 90 Then
Text2 = H良好!”
Else
Text2 = M优秀!”
End If
End Sub
Private Sub Command2_Click()
Textl =,n,
Text2 =nn
End Sub
Private Sub Command1_Click()
Dim x!
x = Textl
Select Case x
Case Is < 60
Text2 = ”重考!”
Case Is < 70
Text2 = M及格!”
Case Is <
Text2「中等!”
Case Is < 90
Text2 ="良好!"
Case Else
Text2 = "ft;秀!”
End Select
End Sub
Private Sub Command2_Click()
Textl = ”"
Text2 =""
End Sub
4-7
Dim s As String
Private Sub Form_Click()
s = lnputBox("请输入年龄")
If s < 30 Then
Print “您的年龄为”;s,"请参加长跑运动”
Elself s < 40 Then
Print ”您的年龄为”;s, ”请参加跳绳运动”
Elself s < 50 Then
Print ”您的年龄为”;s,”请参加竞走运动”
Else
Print ”您的年龄为”;s5%青参加慢跑运动”
End If
End Sub
4-
Private Sub Form_Click()
For n = 2 To 100 Step 2
Print n;
If n Mod 20 = 0 Then Print
Next n
End Sub
4-9
Private Sub Form_click()
For n = 100 To 1000
If n Mod 3 = 2 And n Mod 5 = 3 And n Mod 7 = 2
Then Print n;
Next n
Print
End Sub
4-10
Private Sub Form_click()
m = 0: n = 0
Do
r% = lnputBox(H请输入学生成绩”)
m = m + r
n = n + 1
Loop Until r = -1 Print"学生平均成绩=";(m + 1) / (n -1)
End Sub
4-11
Private Sub Form_click()
Dim a As Integer
Dim s As Integer
a = 1
Do
s = s + (-1) A (a + 1) * a
a = a + 1
Loop Until a > 100 Print" 1-2+3-4+5-6+...+99-100="; s
End Sub
4-12
Private Sub Form_Click()
Dim n As Integer
Dim m As Integer
Dim s As Integer
m% = lnputBox(n请输入正整数m(m>=1儿”阶乘”) n% = lnputBox("请输入正整数n(n>=m)”,"阶乘")
For m = m To n
t = 1
For i = 1 To m
t = t* i
Next i
s = s + t
Next m
Print" m!+(m+1)!+...+n!="; s
End Sub
4-13
Private Sub Form_click()
Dim a%
Dim b%
Dim c%
For a = 1 To 20
For b = 1 To 20
For c = 1 To 20
lfa*a + b*b = c*c Then
Print a, b, c
End If
Next c
Next b
Next a
End Sub
4- 14
Private Sub Form_click()
For n = 1 To 500
For i = 1 To n - 1
If n Mod i = 0 Then s = s + i
Next i
If s = n Then Print i;
s = 0
Next n
Print
End Sub
4-15
Private Sub Form_click()
Dim i As Integer
Dim n As Long
n = 1
t= 1
Do While t> 0.00001
e = e +1
i = i + 1
n = n * i
t = 1 / n
Loop
Print "e的近似值是";e
End Sub
5—1
Private SubForm_Click()
Dim i%5 x(1 To 5)As String
For i = LBound(x)To UBound(x)
x(i) =lnputBox(" x (” & i & ”)")
Next i
For i = UBound(x)To LBound(x) Step -1
Print x(i)
Next i
Print
End Sub 5-2
Private Sub Form_Click()
Dim i%5 s
s = Array(1,2, 3, 4, 5, 6, 7, 8, 9, 10)
For i = 0 To 9
If s(i) Mod 3 = 0 Then
Print s(i); i
Else
Print""
End If
Next i
Print
End Sub
5-3
Option Base 1
Private Sub Command1_Click()
Dim x()
x = Array(1,2, 3, 4, 5, 6, 7, 8, 9, 10) t = x(1) For i = 1 To 9
x(i) = x(i + 1)
Print x(i);
Next
x(10) = t
Print x(i)
End Sub
Private Sub Command2_Click()
Dim x()
x = Array(1,2, 3, 4, 5, 6, 7, ,9,10)
t = x(10)
For i = 9 To 1 Step -1
x(i + 1) = x(i)
Next i
x(1) =t
For i = 1 To 10
Print x(i);
Next i
End Sub 5-4
Private Sub Form_Click()
Dim a(5, 5)
For i = 1 To 5
Sum = 0
For j = 1 To 5 a(i, j) = lnt(Rnd * 51 + 10) Sum = Sum + a(i5 j)
Print a(i, j);
Next j
Print Sum
Next i
Print
For i = 1 To 5
For j = 1 To 5
If i = j Then Print a(i, j);
Next j
Next i
Print
End Sub
5- 5
Private Sub Form_Click()
Dim a() As Integer
Dim Max As Integer, iMax As Integer, jMax As Integer
Dim Min As Integer, iMin As Integer, jMin As Integer M = lnputBox("输入M")
N = lnputBox("输入N")
ReDima(M, N)
For i = 1 To M
For j = 1 To N
a(i, j) = lnt(Rnd * 900) + 100
Next j
Next i
For i = 1 To M
For j = 1 To N
Print a(i, j);
Next j
Print
Next i
Max = a(1, 1): Min = a(1, 1)
For i = 1 To M
For j = 1 To N
If a(i, j) > Max Then Max = a(i, j): iMax = i: jMax = j f a(i, j) v Min Then Min = a(i, j): iMin = i: jMin = j Next j Next i
Print "Max="; Max, "iMax="; iMax, "jMax="; jMax Print "Min="; Min, "iMin="; iMin, "jMin="; jMin
Erase a
End Sub
5-6
Private Sub Form_Click()
n = lnputBox("n")
ReDim a(n5 n)
For i = 1 To n
For j = 1 To n
If i = j Then
a(i, j) = 1
Else
a(i, j) = 0
End If
Next j
Next i
For i = 1 To n
Forj = 1 To n
Print a(i, j);
Next j
Print
Next i
Erase a
End Sub
5- 7
Private Sub Form_Click()
Dim x As Variant
x = Array(1,2, 3, 4, 5, 6, 7, 8, 9, 10) For i = 1 To 10
Print x(i);
Next i
Print
For i = 1 To 7
x(i) = x(i + 3)
Print x(i);
Next i
Print
ReDim Preserve x(i)
x = Array(1,2, 3, 4, 5, 6, 7) or i = 1 To 7
Print x(i);
Next i
Print
End Sub
Option Base 1
Private Sub Command1_Click(lndex As Integer) Select Case Index
Case 1
Text3 = Vai (Text 1) + Val(Text2)
Case 2
Text3 = Textl - Text2
Case 3
Text3 = Textl * Text2
Case 4
Text3 = Textl / Text2
End Select
End Sub
6- 1
Private Sub Form_click()
Dim x As Single
Dim y As Single
Dim z As Single
X = InputBox("请输入圆柱体的半径") y = lnputBox(”请输入圆柱体的高度”) volume x, y, z Print"圆柱体的体积为";z
End Sub
6-2
窗体模块
Private Sub Form_click()
Dim a!5 b!,c!
a = lnputBox(H请输入圆柱体的半径J
b = lnputBox("iS输入圆柱体的高度")
c = volume(比b)
Print"圆柱体的体积为";c
End Sub
标准模块
Function volume(r As Single, h As Single) As Single volume = 3.14 * r * r * h
End Function
6- 3
Private Sub Form_Click()
Dim y%
y = lnputBox("请输入一个整数")
Call week(y)
End Sub
6-4
窗体模块
Private Sub Form_click()
Dim a As Integer, b As String
a = lnputBox("请输入一个整数")
b = week(a)
Print b
标准模块
Function week(s As Integer) As String
Select Case s
Case 0
week ="星期日"
Case 1
week ="星期一"
Case 2
week ="星期二"
Case 3
week ="星期三"
Case 4
week ="星期四"
Case 5
week ="星期五"
Case 6
week ="星期六"
Case Else
Msg Box "数据无效’
End Select
End Function
6-5
窗体模块
Private Sub Form_click()
Dim n As Single, w As String
n = lnputBox("请输入一个正整数") Select Case w
Case judge = 0
Print"此数为偶数”
Case Else
Print"此数为奇数"
Print w
End Select
End Sub
标准模块
Function w(n As Single) As String
w = n \ 2
Select Case w
Case w = 0
Print"此数为偶数"
Case Else
Print"此数为奇数"
End Function
6-7
Sub lenUL(ByVal s As String, 11%, L%) Dim i As Integer
For i = 1 To Len(s)
Select Case Mid(s, i, 1)
Case "A" To "Z"
U = U + 1
Case •'a" To ”z"
L= L+ 1
End Select
Next i
End Sub
Private Sub Command1_Click() Dim U%, L%
Call lenUL(Text1, U, L)
Text2 = U
Text3 = L
End Sub
Private Sub Command2_Click() Textl ="”
Text2 = ””
Text3 =""
Textl .SetFocus
End Sub
7- 1
Private Sub Command1_Click()
I magel.Picture = LoadPicture 化:\ 图片
\picture5.JPG")
End Sub
Private Sub Command2_Click()
I magel.Picture = LoadPicture(H c:\ 图片
\picture3.JPG")
End Sub
Private Sub Command3_Click()
I magel Picture = LoadPicture(H c:\ 图片
\picture4.JPG")
End Sub
7-2
Private Sub Command1_Click()
Static a As Integer
a = a + 1
If a Mod 2 <> 0 Then
I magel.Picture = LoadPicture("c:\ 图片\p2.JPG") Image2 Picture = LoadPicture("c:\ 图片\p1 .JPG") Else
Imagel Picture = LoadPicture(H c:\ 图片\p1.JPG”) Image2 .Picture = LoadPicture("c:\ 图片\p2.JPG") End
If
End Sub
Private Sub Form_Load()
Imagel .Picture = LoadPicture("c:\ 图片\p1 .JPG")
I mage2. Picture = LoadPicture("c:\ 图片\p2.JPG") End Sub
7-3
Private Sub Timer1_Timer()
Forml .Picture = I mage3. Picture
I mage3.Picture = Image2.Picture
I mage2.Picture = Imagel.Picture
Imagel .Picture = Forml .Picture
End Sub
7-4
Private Sub Form_Load()
Timer 1. Enabled = False
End Sub
Private Sub Timer1_Timer()
If lmage2.Top >= -Image2.Height Then lmage2.Top = lmage2.Top - 100
Else
Image2.7bp = -Image2.Height
End If
End Sub
7-5
Private Sub Form_Load()
HScrolH .Min = 0
HScrolH .Max = I mage 1 .Width
Imagel .Width = 0
End Sub
Private Sub HScrolH_Scroll()
Imagel .Width = HScrolH
Label 1 ="当前图片宽度:"&HScroll 1 .Value End Sub
7-6
Private Sub Command1_Click()
For i = ProgressBarl.Min To ProgressBarl .Max ProgressBarl .Value = i
(Forj = 1 To 20000
Next j)(延时)
Next i
End Sub
7-7
Private Sub Command 1_Click() a = Ilf(0ption1,H 男”,”女”) b = Ilf(0ption3, ”硕士”,”博士”) c = Hf(Check1,"音乐","") d = llf (Check2, ”演讲”,"") e = llf(Check3,H体育 f = llf(Check4, ”集邮“,”")
Text2 ="姓名:"& Textl .Text & & "性别:"& a & ",“ & ”学历:” & b & ”,” & ”特长:” & c & ",” & d & & e &
End Sub
Private Sub Command2_Click()
Textl = ””
Text2 = ”"
Textl .SetFocus
End Sub 7-
Private Sub Form_Load()
Combol .Additem "河南省"
Combol .Additem "开封市"
Combol .Additem ”河南大学”
Combol .Additem ”金明校区”Combol .Additem ”环境与规划学院”Combol .Additem ”09级”
Combol .Additem "地理科学专业" Combol .Additem "刘彬"
Combol .Additem "毕业于”Combol.Additem ”湖南省”
Combol .Additem "衡山县"
Combol .Additem ”第二中学”
Combol .Additem n21 班
End Sub
Private Sub Combo1_Click()
Listl .Additem Combol .Text
End Sub
Private Sub List1_DblClick()
Listl ・Removeitem Listl ・Listindex End Sub
Dim x As Single, y As Single
Private Sub Pt1_Click()
Pt1 .Scale (0, 100)-(100,0)
Pt 1-DrawWidth = 2
For x = 0 To 100 Step 0.02 PtXPSet (x, 2), vbRed
Next x
For y = 0 To 100 Step 0.02
Pt1 .PSet (2, y), vbRed
Next y
Pt1 .CurrentX = 2
Pt1 .CurrentY = 5
Pt1P rint "(0,0)"
-2
End Sub
Private Sub P1_Click()
P1 .Scale (0, 100)-(100, 0)
P1.FillStyle = 7
P1 .DrawWidth = 5
P1 .FillColor = vbGreen
P1 .Line (10, 90)-(90, 10), vbRed, B
-3
End Sub
Private Sub Form_click()
Scale (-100, 100)-(100, -100) Line (-100, 0)-(1005 0)
Line (O5-1OO)-(O5 100)
CurrentX = 2
CurrentY = 6
Print "(0,0)"
End Sub
Private Sub Form_click()
Scale (-100, 100)-(100, -100)
Line (-100, 0)-(100, 0)
Line (0,-100)-(0, 100)
For x = -100 To 100 Step 0.02 y=10*Sin(x)-
10*Cos(2*x) PSet (x, y), vbRed
Next x
End Sub
Private Sub Form_Click()
Timerl ・ Enabled = True
End Sub
Private Sub Timer1_Timer()
Randomize
Scale (-120, 120)-(120, -120)
DrawWidth = 2
If r < 100 Then
r = r + 2
For r = 0 To 100
Circle (0, 0), r, RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
Next r
End If
End Sub
9- 1
Private Sub Textl_KeyPress(K As Integer)
K = K + 3
End Sub
9- 2
Private Sub Textl_KeyPress(K As Integer) Select Case K
Case 4 To 57
Case Else
K = 0
End Select
End Sub
9- 6
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, YAs Single) MousePointer = 5
End Sub
Private Sub Textl_MouseMove(Button As Integer,
Shift As Integer, X As Single, YAs Single) MousePointer = 11
End Sub
Private Sub Picture1_Click()
Mouseicon = Picture 1・ Mouseicon
Picture 1. Mouseicon = Image 1. Mouseicon
Image 1. Mouseicon = Form 1. Mouseicon
End Sub
9- 7
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Shift = vbCtrlMask And Button = vbLeftButton
Then Print "Ctrl+左键+移动”
If Shift = vbAltMask And Button = vbRightButton
Then Print "Alt+右键+移动"
End Sub
Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
CIs
End Sub 9-
Sub Picture1_MouseMove(Button As Integer, Shift
As Integer, X As Single, YAs Single)
If Button = vbLeftButton Then Picturel .Print Str(X) + + Str(Y)
BackColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256) End Sub
10- 1
Private Sub Command1_Click()
Open "d:\data1 .txt" For Output As #1
Write #15H601n, “杨大昌”;”4550“
Write #1, H603H5”李文圣6H
Write #1张燕H; H2235H
Close #1
End Sub
Private Sub Command2_Click()
Open "d:\data1 .txt" For Input As #2
Do While Not EOF(2)
Input #2, X13 X2, x3
Print X1, X2, x3
Loop
Close
End Sub
10- 2
Private Sub Command1_Click()
Open "d:\data1 .txt" For Append As #3 Write #3, Textl, Text2, Text3
Textl = ””
Text2 ="”
Text3 = ””
Close
End Sub
Private Sub Command2_Click()
Close
End
End Sub
10- 5
Private Sub Form_Click()
Dim sum As Long
For n = 1 To 100 Step 2
sum = sum + n
Next n
Print sum
End Sub
Private Sub Form_Load()
Open "d:\data5.txt" For Output As #1 For n = 1 To 100 Step 1
Print #1, n;
Next n
Close
End Sub
10- 6
Private Sub Form_Click()
Dim sum As Integer
For n = 10 To 100 Step 10
sum = sum + n
Next
Print sum
End Sub
Private Sub Form_Load()
Open "d:\data6.dat" For Random As #1 For n = 1 To 100
Put #1, , n
Next
End Sub
11- 1
Private Sub Command1_Click() CommonDialogl ・ Action = 3
Textl .BackColor = CommonDialogl .Color
End Sub
Private Sub Command2_Click() CommonDialogl .Flags = 263 CommonDialogl ・ Action = 4
Textl ・ FontSize = CommonDialogl ・Fo ntSize Textl .FontName = CommonDialogl .FontName Textl .FontBold = CommonDialogl .FontBold Textl .FontStrikethru
CommonDialogl .FontStrikethru
Textl ・ ForeColor = CommonDialogl .Co lor Textl ・ FontUnderline
CommonDialogl .FontUnderline
End Sub
Private Sub Command3_Click()
CommonDialogl ・ Action = 2
End Sub
11- 2
Private Sub Command1_Click()
CD1 .InitDir = "C:\Documents and
Setting s\Ad mini strato r\桌面”
CD1 .Filter ="图片|*.jpg| 文本文件|*.txt|”
CD1 .ShowOpen
If CD1 .Filterindex = 1 Then
I magel.Picture = LoadPicture(CD1 .FileName) Else
Open CD1 .FileName For Input As #1
Do While Not EOF(1)
Line Input #1, n
Textl = Textl + n + vbNewLine
Loop
End If
End Sub
11- 4
Private Sub Form_Resize()
Textl 丄eft = 50
Textl .Top = 50
Textl .Width = Width - 2000
Textl .Height = Height - 5000
End Sub
Private Sub mnuName_Click(lndex As Integer) Select Case Index
Case 5
Textl .FontName ="宋体"
Case 10
Textl .FontName ="黑体"
Case 15
Textl .FontName ="隶书"
End Select
End Sub
11- 6
Private Sub Form_Load()
Textl .Width = Width
Textl .Height = Height
End Sub
Private Sub Form_Resize()
Textl 丄eft = 50
Textl .Top = 650
Textl .Width = Width - 200
Textl .Height = Height - 900
End Sub
Private Sub mnuCopy_Click()
s = Textl .SelText
mnuPaste.Enabled = True
End Sub
Private Sub mnuCut_Click()
s = Textl .SelText
Textl .SelText =""
mnuPaste.Enabled = True
End Sub
Private Sub mnuPaste_Click()
Textl .SelText = Textl + s
End Sub
11-7
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) PopupMenu mnuTitle, 2, 0, 0
End Sub
Private Sub mnuDate_Click()
Caption = Date
BackColor = vbYellow
End Sub
Private Sub mnuTime_Click() Caption = Time
BackColor = vbRed
End Sub。

相关文档
最新文档