Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Rewrite logic for progress bars #81

Open
ed-asriyan opened this issue Nov 26, 2018 · 0 comments
Open

Rewrite logic for progress bars #81

ed-asriyan opened this issue Nov 26, 2018 · 0 comments
Assignees
Labels

Comments

@ed-asriyan
Copy link
Member

логику, по которой отрисовываются линии на карточках объекта и сенсора, надо изменить.

видео работы

код на 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;
@ed-asriyan ed-asriyan added the UI label Nov 26, 2018
@ed-asriyan ed-asriyan self-assigned this Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant