Введение в ABCButtons: различия между версиями

Содержимое удалено Содержимое добавлено
Метка: редактор вики-текста 2017
Метка: редактор вики-текста 2017
Строка 35:
b.FontColor := RGB(255 - b.Color.R, 255 - b.Color.G, 255 - b.Color.B);
end;
end.
</syntaxhighlight>
 
==Простой таймер==
<syntaxhighlight lang="pascal">
uses Timers, GraphABC, ABCObjects, ABCButtons;
const
H = 30;
 
var
Start, Stop: ButtonABC;
Value: RectangleABC;
T: integer;
Timer1: Timer;
 
procedure AddTime();
begin
Inc(T);
Value.Text := IntToStr(T);
end;
 
procedure StartTimer() := Timer1.Start();
 
procedure StopTimer() := Timer1.Stop();
 
begin
SetWindowIsFixedSize(true);
SetWindowSize(300, 100);
SetWindowCaption('Timer');
CenterWindow();
var W := Window.Width div 2;
var Y := Window.Height - H;
Timer1 := new Timer(1000, AddTime);
Start := new ButtonABC(0, Y, W, H, 'Start', clMoneyGreen);
Start.OnClick := StartTimer;
Stop := new ButtonABC(W, Y, W, H, 'Stop', clMoneyGreen);
Stop.OnClick := StopTimer;
Value := new RectangleABC(0, 0, Window.Width, Y, clWhite);
Value.Text := '0';
end.
</syntaxhighlight>