Skip to content

Conversation

@MikePuzanov
Copy link
Owner

No description provided.

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У меня оно выглядит как-то так:
image

Возможно, дело в разрешении монитора

{
public partial class Form1 : Form
{
Timer timer = new Timer();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А ещё в современном C# можно писать Timer timer = new ();


namespace Hw7Clock
{
public partial class Form1 : Form
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не, Form1 как имя класса (и как заголовок окна) очень не очень.

Comment on lines 50 to 61
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));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Какой ужас :) Наверняка можно как-то проще. Посмотрите на graphics.RotateTransform и graphics.TranslateTransform

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну хорошо, не надо Transform-ов, но хоть копипаст-то убрать надо. Шрифт, например, один раз создать и везде его использовать. Сам graphics.DrawString обернуть в функцию, которая бы принимала текст и координаты.

int ss = DateTime.Now.Second;
int mm = DateTime.Now.Minute;
int hh = DateTime.Now.Hour;
int[] coord = new int[2];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Массив, а не кортеж?

{
coordinates[0] = coordX - (int)(hLen * -Math.Sin(Math.PI * value / 180));
coordinates[1] = coordY - (int)(hLen * Math.Cos(Math.PI * value / 180));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже что-то копипаст какой-то

int mm = DateTime.Now.Minute;
int hh = DateTime.Now.Hour;
int[] coord = new int[2];
(int, int) coord;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше (int x, int y) coord;. Тогда вместо страшного coord.Item1, coord.Item2 можно будет писать coord.x, coord.y

Comment on lines 50 to 61
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));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну хорошо, не надо Transform-ов, но хоть копипаст-то убрать надо. Шрифт, например, один раз создать и везде его использовать. Сам graphics.DrawString обернуть в функцию, которая бы принимала текст и координаты.

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants