第1个回答 2009-05-31
Rem 点击command1,求和,点击command2,画圆
Private Sub Command1_Click()
Dim n,i,j,jc,s
k:
n = Val(InputBox("请输入n(1≤n≤10):", , 10))
If n < 1 Or n > 10 Then MsgBox "n输入错误,请重试!": GoTo k
For i = 1 To n
jc = 1
For j = 1 To i
jc = jc * j
Next
s = s + jc * (-1) ^ (i Mod 2 + 1)
Next
Print s
End Sub
Private Sub Command2_Click()
Dim x
Picture1.AutoRedraw = True
Picture1.Height = Picture1.Width
x = Picture1.ScaleWidth
Print x
Picture1.ScaleHeight = x
Picture1.Scale (-x / 2, x / 2)-(x / 2, -x / 2)
Randomize
For i = 1 To 100
Picture1.Circle (0, 0), x / 2 * Rnd, QBColor(Int(16 * Rnd))
Next
End Sub