| |
 |
How can I create a trackbar where the track has a thin line on which the slider moves along, rather than a rather big white space which the slider moves along?
The following example demonstrates creating a descendant of the TTrackbar component that overrides the CreateParams method, and clears the TBS_ENABLESELRANGE flag from the params style. This results in a Trackbar component that has a small thin track for the slider to move upon. Note that the TBS_ENABLESELRANGE constant is declared in the CommCtrl unit.
Example:
uses CommCtrl, ComCtrls;type TMyTrackBar = class(TTrackBar)
procedure CreateParams(var Params: TCreateParams); override;
end; procedure TMyTrackBar.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := Params.Style and not TBS_ENABLESELRANGE;
end; var
MyTrackbar : TMyTrackbar; procedure TForm .Button Click(Sender: TObject);
begin
MyTrackBar := TMyTrackbar.Create(Form );
MyTrackbar.Parent := Form ;
MyTrackbar.Left := 00;
MyTrackbar.Top := 00;
MyTrackbar.Width := 50;
MyTrackbar.Height := 45;
MyTrackBar.Visible := true;
end;
|
|
| Hits/month |
2,500,000+ |
Downloads (Since May 2000) |
7,393,709 |
| Total Files |
6,023 |
| Forum msgs |
7,670 |
| Articles/FAQs |
70+/900+ |
Top Selling Software at Amazon
|