Option Strict On 'VisualBasic2008 Public Class Form1 Private hari As Integer '針 Private hour As Integer '時 Private Function cosS(ByVal nagasa As Integer, ByVal kakudo As Integer, ByVal iro As Pen) As Integer Dim x, y As Integer x = CInt(nagasa * Math.Cos(kakudo * 3.14159 / 180)) y = CInt(nagasa * Math.Sin(kakudo * 3.14159 / 180)) Me.PictureBox1.CreateGraphics().DrawLine(iro, 150, 150, 150 + x, 150 + y) Me.PictureBox1.CreateGraphics().Dispose() End Function Private Sub hariHyouji() Dim i As Integer = 270 PictureBox1.Refresh() hari = CInt(DateTime.Now.Second) hari = hari * 6 + i cosS(100, hari, Pens.Black) hari = CInt(DateTime.Now.Minute) hour = hari hari = hari * 6 + i cosS(80, hari, Pens.Aqua) hari = CInt(DateTime.Now.Hour) hari = CInt((hari * 30 + i) + hour / 2) cosS(50, hari, Pens.Red) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick hariHyouji() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Timer1.Start() Timer1.Interval = 300 End Sub End Class