As Integer = Me. ClientSize. Width 'горизонталь
'заливка форми білим кольором. Clear (Color. White)
'Робимо прозорим задній фон
Me. TransparencyKey = Color. White
'перенесення початку координат в центр. TranslateTransform (Me. ClientSize. Width * 0.5, Me. ClientSize. Height * 0.5)
'оформлення годин. FillEllipse (Brushes. SaddleBrown, -100, -100, 200, 200). FillEllipse (Brushes. Peru, -95, -95, 190, 190). FillEllipse (Brushes. LemonChiffon, -90, -90, 180, 180). DrawEllipse (Pens. Black, -90, -90, 180, 180). DrawEllipse (Pens. Black, -85, -85, 170, 170)
'штрихи позначають години і хвилини
Dim i As Integeri = 1 To 12. DrawLine (pen1, (199 2) - (90 10), 0, 80, 0). RotateTransform (30) p As Integerp = 1 To 60. DrawLine (pen1, (84), 0, 90, 0). RotateTransform (6)
'Малюємо цифри на годиннику. DrawString (В«1В», Me. Font, Brushes. Black, 30, -70). DrawString (В«2В», Me. Font, Brushes. Black, 58, -42). DrawString (В«3В», Me. Font, Brushes. Black, 69, -6). DrawString (В«4В», Me. Font, Brushes. Black, 59, 31). DrawString (В«5В», Me. Font, Brushes. Black, 30, 58). DrawString (В«6В», Me. Font, Brushes. Black, -5, 65). DrawString (В«7В», Me. Font, Brushes. Black, -40, 57). DrawString (В«8В», Me. Font, Brushes. Black, -68, 31). DrawString (В«9В», Me. Font, Brushes. Black, -78, -6). DrawString (В«10В», Me. Font, Brushes. Black, -68, -43). DrawString (В«11В», Me. Font, Brushes. Black, -40, -70). DrawString (В«12В», Me. Font, Brushes. Black, -8, -78) SubSub Form1_Load (ByVal sender As Object, ByVal e As System. EventArgs) Handles MyBase. Load
'подвійна буферизація, прибирає мерехтіння при перемальовуванні (ControlStyles. UserPaint, True) (ControlStyles. AllPaintingInWmPaint, True) (ControlStyles. DoubleBuffer, True) SubSub Timer1_Tick (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Timer1. Tick ​​
'примусова перемальовування, через 1 секунду. Invalidate () SubSub Form1_Paint (ByVal sender As Object, ByVal e As System. Windows. Forms. PaintEventArgs) Handles MyBase. Paint
'тут ходять стрілки часовg As Graphics = e. Graphicsbrush1 As Brush = New SolidBrush (Color. Red) brush2 As Brush = New SolidBrush (Color. Black) brush3 As Brush = New SolidBrush (Color. Brown)
'дізнаємося скільки времяt As New DateTime () = DateTime. Nowwh As New Size (Me. ClientSize. Width * 0.5, Me. ClientSize. Height * 0.5) j As Integer = Me. ClientSize. Heightj> Me. ClientSize. Width Then j = Me. ClientSize. Width * = 0.15 'Коефіцент розміру стрілок
'малюємо cекундную стрілку
Dim ps1 As New Point (0, 0) ps2 As New Point (0, 1.3) ...