|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC As Long) As Long
'Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub CommandButton1_Click()
Dim hwnd, dc, rgbColor
hwnd = FindWindow(vbNullString, Me.Caption)
hDC = GetDC(hwnd)
Pi = 3.1415926
For i = 1 To 49
'Me.BackColor = RGB(255, 255, 255)
If i Mod 6 = 1 Then
rgb2 = RGB(255, 0, 0)
ElseIf i Mod 6 = 2 Then
rgb2 = RGB(255, 255, 0)
ElseIf i Mod 6 = 3 Then
rgb2 = RGB(0, 255, 0)
ElseIf i Mod 6 = 4 Then
rgb2 = RGB(0, 255, 255)
ElseIf i Mod 6 = 5 Then
rgb2 = RGB(0, 0, 255)
ElseIf i Mod 6 = 0 Then
rgb2 = RGB(255, 0, 255)
End If
For t = Pi * (i - 1) To Pi * i Step 0.001
X = Sin(t) * (Exp(Cos(t)) - 2 * Cos(4 * t) - Sin(t / 12) ^ 5)
Y = Cos(t) * (Exp(Cos(t)) - 2 * Cos(4 * t) - Sin(t / 12) ^ 5)
rgbColor = SetPixel(hDC, 300 + 60 * X, 320 - 60 * Y, rgb2)
Sleep 0.5
DoEvents
Next
Next
ReleaseDC hwnd, hDC
End Sub
|
|