ProgressBarPosition (C++)

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

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  ProgressBar1->Min = 0;
  ProgressBar1->Max = Memo1->Width;
  ProgressBar2->Min = 0;
  ProgressBar1->Max = Memo1->Height;

}

void __fastcall TForm1::Memo1MouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
  Label1->Caption = IntToStr(X);
  Label2->Caption = IntToStr(Y);
  ProgressBar1->Position = X;
  ProgressBar2->Position = Y;
}

Uses