Conversation
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| { | ||
| public partial class Form1 : Form | ||
| { | ||
| Timer timer = new Timer(); |
There was a problem hiding this comment.
А ещё в современном C# можно писать Timer timer = new ();
Hw7Clock/Hw7Clock/Form1.cs
Outdated
|
|
||
| namespace Hw7Clock | ||
| { | ||
| public partial class Form1 : Form |
There was a problem hiding this comment.
Не, Form1 как имя класса (и как заголовок окна) очень не очень.
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| graphics.DrawString("1", new Font("Elephant", 12), Brushes.Black, new PointF(210, 25)); | ||
| graphics.DrawString("2", new Font("Elephant", 12), Brushes.Black, new PointF(260, 70)); | ||
| graphics.DrawString("3", new Font("Elephant", 12), Brushes.Black, new PointF(280, 142)); | ||
| graphics.DrawString("4", new Font("Elephant", 12), Brushes.Black, new PointF(260, 200)); | ||
| graphics.DrawString("5", new Font("Elephant", 12), Brushes.Black, new PointF(210, 255)); | ||
| graphics.DrawString("6", new Font("Elephant", 12), Brushes.Black, new PointF(142, 276)); | ||
| graphics.DrawString("7", new Font("Elephant", 12), Brushes.Black, new PointF(70, 255)); | ||
| graphics.DrawString("8", new Font("Elephant", 12), Brushes.Black, new PointF(25, 200)); | ||
| graphics.DrawString("9", new Font("Elephant", 12), Brushes.Black, new PointF(0, 140)); | ||
| graphics.DrawString("10", new Font("Elephant", 12), Brushes.Black, new PointF(25, 70)); | ||
| graphics.DrawString("11", new Font("Elephant", 12), Brushes.Black, new PointF(70, 25)); | ||
| graphics.DrawString("12", new Font("Elephant", 12), Brushes.Black, new PointF(140, 2)); |
There was a problem hiding this comment.
Какой ужас :) Наверняка можно как-то проще. Посмотрите на graphics.RotateTransform и graphics.TranslateTransform
There was a problem hiding this comment.
Ну хорошо, не надо Transform-ов, но хоть копипаст-то убрать надо. Шрифт, например, один раз создать и везде его использовать. Сам graphics.DrawString обернуть в функцию, которая бы принимала текст и координаты.
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| int ss = DateTime.Now.Second; | ||
| int mm = DateTime.Now.Minute; | ||
| int hh = DateTime.Now.Hour; | ||
| int[] coord = new int[2]; |
There was a problem hiding this comment.
Массив, а не кортеж?
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| { | ||
| coordinates[0] = coordX - (int)(hLen * -Math.Sin(Math.PI * value / 180)); | ||
| coordinates[1] = coordY - (int)(hLen * Math.Cos(Math.PI * value / 180)); | ||
| } |
There was a problem hiding this comment.
Тоже что-то копипаст какой-то
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| int mm = DateTime.Now.Minute; | ||
| int hh = DateTime.Now.Hour; | ||
| int[] coord = new int[2]; | ||
| (int, int) coord; |
There was a problem hiding this comment.
Лучше (int x, int y) coord;. Тогда вместо страшного coord.Item1, coord.Item2 можно будет писать coord.x, coord.y
Hw7Clock/Hw7Clock/Form1.cs
Outdated
| graphics.DrawString("1", new Font("Elephant", 12), Brushes.Black, new PointF(210, 25)); | ||
| graphics.DrawString("2", new Font("Elephant", 12), Brushes.Black, new PointF(260, 70)); | ||
| graphics.DrawString("3", new Font("Elephant", 12), Brushes.Black, new PointF(280, 142)); | ||
| graphics.DrawString("4", new Font("Elephant", 12), Brushes.Black, new PointF(260, 200)); | ||
| graphics.DrawString("5", new Font("Elephant", 12), Brushes.Black, new PointF(210, 255)); | ||
| graphics.DrawString("6", new Font("Elephant", 12), Brushes.Black, new PointF(142, 276)); | ||
| graphics.DrawString("7", new Font("Elephant", 12), Brushes.Black, new PointF(70, 255)); | ||
| graphics.DrawString("8", new Font("Elephant", 12), Brushes.Black, new PointF(25, 200)); | ||
| graphics.DrawString("9", new Font("Elephant", 12), Brushes.Black, new PointF(0, 140)); | ||
| graphics.DrawString("10", new Font("Elephant", 12), Brushes.Black, new PointF(25, 70)); | ||
| graphics.DrawString("11", new Font("Elephant", 12), Brushes.Black, new PointF(70, 25)); | ||
| graphics.DrawString("12", new Font("Elephant", 12), Brushes.Black, new PointF(140, 2)); |
There was a problem hiding this comment.
Ну хорошо, не надо Transform-ов, но хоть копипаст-то убрать надо. Шрифт, например, один раз создать и везде его использовать. Сам graphics.DrawString обернуть в функцию, которая бы принимала текст и координаты.

No description provided.