A pen's width determines the thickness, in pixels, of the lines it draws.
Suppose you have a scroll bar on the pen's toolbar to set width values for the pen. And suppose you want to update the label next to the scroll bar to provide feedback to the user. Using the scroll bar's position to determine the pen width, you update the pen width every time the position changes.
This is how to handle the scroll bar's OnChange event:
procedure TForm1.PenWidthChange(Sender: TObject); begin Canvas.Pen.Width := PenWidth.Position;{ set the pen width directly } PenSize.Caption := IntToStr(PenWidth.Position);{ convert to string for caption } end;
void __fastcall TForm1::PenWidthChange(TObject *Sender) { Canvas->Pen->Width = PenWidth->Position; // set the pen width directly PenSize->Caption = IntToStr(PenWidth->Position); // convert to string }
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|