ProgressBarPosition (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires two ProgressBars, two labels, and a Memo. The ProgressBar and the label captions are updated as the mouse moves inside the Memo.

Code

procedure TForm1.FormCreate(Sender: TObject);
begin
  ProgressBar1.Min := 0;
  ProgressBar1.Max := Memo1.Width;
  ProgressBar2.Min := 0;
  ProgressBar1.Max := Memo1.Height;
end;

procedure TForm1.Memo1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Label1.Caption := InttoStr(X);
  Label2.Caption := InttoStr(Y);
  ProgressBar1.Position := X;
  ProgressBar2.Position := Y;
end;

Uses