Üye Kayıt Üye Giriş

Analog Saat


 Analog Saat


'Forma bir adet timer ekleyin

Dim cSize As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
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
Const PI = 3.14159

Private Sub Form_DblClick()
End
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
End
End If
End Sub

Private Sub Form_Load()
If App.PrevInstance Then End
cSize = CreateEllipticRgn(4, 23, 270, 290)
SetWindowRgn Me.hWnd, cSize, True
Call Timer1_Timer
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
ReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub

Private Sub Timer1_Timer()
Dim H As Single, M As Single, S As Single
Dim TotHours As Single

H = Hour(Time)
M = Minute(Time)
S = Second(Time)
TotHours = H + M / 60

LH.X2 = 700 * Cos(PI / 180 * (30 * TotHours - 90)) + LH.X1
LH.Y2 = 700 * Sin(PI / 180 * (30 * TotHours - 90)) + LH.Y1

LM.X2 = 1200 * Cos(PI / 180 * (6 * M - 90)) + LH.X1
LM.Y2 = 1200 * Sin(PI / 180 * (6 * M - 90)) + LH.Y1

LS.X2 = 1200 * Cos(PI / 180 * (6 * S - 90)) + LH.X1
LS.Y2 = 1200 * Sin(PI / 180 * (6 * S - 90)) + LH.Y1

End Sub

Bilgisayar Dershanesi Ders Sahibi;
Bilgisayar Dershanesi

Yorumlar

Yorum Yapabilmek İçin Üye Girişi Yapmanız Gerekmektedir.

ETİKETLER