Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Customizing TTrackBar


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;

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use