Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Sub Command1_Click()
Command1.Picture = Image1.Picture
End Sub
Private Sub Command2_Click()
Dim I As Integer
Dim J As Integer
Dim Str As String
Dim SZ(65 To 65 + 26) As Integer
Dim Temp
Dim Temp1
Str = "A123~B111~C131~D211~E144~F177~Z244~N012"
Me.Print Str
Temp = Split(Str, "~")
For I = 0 To UBound(Temp)
For J = 65 To 65 + 26
Temp1 = Split(Temp(I), Chr(J))
If UBound(Temp1) = 1 Then SZ(J) = Val(Temp1(1))
Next
Next
For J = 65 To 65 + 26
If SZ(J) <> 0 Then Me.Print Chr(J) & "=" & SZ(J)
Next
End Sub
Private Sub Command3_Click()
Dim PI As Double
Dim N As Integer
Dim T As Double
Dim 符号 As Integer
Dim I As Integer
PI = 0
N = 10
符号 = 1
For I = 1 To N
T = 符号 * 1 / (2 * I - 1)
符号 = -符号
PI = T + PI
Next
Me.Print PI * 4
End Sub
Private Sub Command4_Click()
Me.Print &HAA
Me.Print Hex(170)
End Sub
Private Sub Form_Load()
Dim A, B As Long
Dim w, h As Long
Command1.Width = Command1.Height
h = Command1.Height / 15 '圆高直径=Command1.Height
w = Command1.Width / 15 '圆宽直径 = h
A = CreateEllipticRgn(5, 5, w - 5, h - 5)
B = SetWindowRgn(Command1.hWnd, A, True) '把Command1设置成圆形
End Sub
Private Sub Form_Activate()
Dim S1 As String
Dim S2 As String
S1 = "文道网络科技"
S2 = "易经 道德经 黄帝内经 史记 资治通鉴 春秋 三国 论语 中庸 大学"
Me.Caption = S1 + "喜欢" + S2
End Sub
Private Sub Form_Click()
Dim m As Integer
Dim N As Integer
Dim A As Integer
Dim I As Integer
m = 15
N = 10
Randomize
For I = 1 To 3600
A = Int(Rnd * (m - N + 1)) + N
Me.Print A & " ";
If I Mod 60 = 0 Then Me.Print
Next
End Sub