برنامه ساعت آنالوگ در ویژوال بیسیک

Private Sub Form_Load()
    Me.BackColor = vbBlack
End Sub


Private Sub Timer1_Timer()
 
    Form1.Refresh
    X = Form1.Width / 2
    Y = Form1.Height / 2.2
    Circle (X, Y), Y - 200, vbWhite
    Circle (X, Y), Y - 220, vbWhite
    For i = 1 To 12
         Circle (X + (Y - 400) * Cos(i * 22 / 42), Y + (Y - 400) * Sin(i * 22 /42)), 50, vbRed
    Next i
    h = Hour(Time())
    If h > 12 Then
        h = h - 12
    End If
    m = Minute(Time())
    s = Second(Time())
    Line (X, Y)-(X + (Y - 600) * Cos((66 / 14 + s * (44 / 420))), Y + (Y - 600) * Sin((66 / 14 + s * (44 / 420)))), vbBlue
    Line (X, Y)-(X + (Y - 800) * Cos((66 / 14 + m * (44 / 420))), Y + (Y - 800) * Sin((66 / 14 + m * (44 / 420)))), vbYellow
    Line (X, Y)-(X + (Y - 1200) * Cos(66 / 14 + h * (44 / 84) + (m / 12) * (44 / 420)), Y + (Y - 1200) * Sin(66 / 14 + h * (44 / 84) + (m / 12) * (44 / 420))), vbWhite


End Sub

/ 0 نظر / 13 بازدید