This repository was archived by the owner on Mar 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Mar 13, 2021. It is now read-only.
Rewrite logic for progress bars #81
Copy link
Copy link
Open
Labels
Description
логику, по которой отрисовываются линии на карточках объекта и сенсора, надо изменить.
код на Delphi:
procedure TForm1.repaint(a,b,c: Integer);
var
mx : Integer;
length, oldsize : Integer;
division : Real;
begin
length := PaintBox1.Width;
with PaintBox1.Canvas do
begin
Brush.Color := Form1.Color;
FillRect(PaintBox1.ClientRect);
Pen.Color := clgray;
Rectangle(1,1,PaintBox1.Width,100);
Font.Color := clgray;
TextOut(5,10,'Ноябрь 2018:');
TextOut(5,30,'Ноябрь 2017:');
TextOut(5,50,'Среднее 2017:');
end;
with PaintBox1.Canvas do
begin
//TextOut(PaintBox1.Width-60, 10, IntToStr(a)+' кВт'); // раскоментить для варианта без прогноза
TextOut(PaintBox1.Width-100, 10, IntToStr(a)+' кВт'); //для прогноза
oldsize := Font.Size; //2
Font.Size := 6; //2
TextOut(PaintBox1.Width-40, 14, Edit1.Text+' кВт'); //для прогноза
Font.Size := oldsize; //2
TextOut(PaintBox1.Width-60, 30, IntToStr(b)+' кВт');
TextOut(PaintBox1.Width-60, 50, IntToStr(c)+' кВт');
end;
//mx := max_num(max_num(StrToInt(Edit1.Text),b),c); //для прогноза
mx := max_num(max_num(a,b),c);
division := length/mx;
with PaintBox1.Canvas do
begin
Pen.Color := clActiveBorder;
MoveTo(0,25);
LineTo(length,25);
MoveTo(0,45);
LineTo(length,45);
MoveTo(0,65);
LineTo(length,65);
Pen.Color := clblue;
MoveTo(0,25);
LineTo(Round(a*division),25);
Pen.Color := clyellow; //для прогноза
MoveTo(Round(a*division),25); //для прогноза
LineTo(Round(StrToInt(Edit1.Text)*division),25); //для прогноза
Pen.Color := clblue; //для прогноза
end;
with PaintBox1.Canvas do
begin
MoveTo(0,45);
LineTo(Round(b*division),45);
end;
with PaintBox1.Canvas do
begin
MoveTo(0,65);
LineTo(Round(c*division),65);
end;
end;Reactions are currently unavailable