Problem Source: http://www.cnblogs.com/del/archive/2008/06/14/1220638.html#1225896
Example 1:
Example 1 Code :
Unit unit1; interfaceuses windows, messages, extensions, variants, classes, graphics, controls, forms, dialogs, comctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; Procedure trackbar1change (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.trackbar1change (Sender: tobject); Begin self. text: = inttostr (trackbar1.position); end.
Example 2:
Example 2 code:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, comctrls, stdctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; button1: tbutton; button2: tbutton; button3: tbutton; Procedure upload (Sender: tobject); Procedure button1click (Sender: tobject); Procedure upload: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure merge (Sender: tobject); begin button1.caption: = 'change'; button2.caption: = 'change'; button3.caption: = 'restore'; end; Procedure tform1.button1click (Sender: tobject); begin trackbar1.showselrange: = false; end; Procedure transaction (Sender: tobject); begin transaction: = trvertical; end; Procedure transaction (Sender: tobject); begin trackbar1.showselrange: = true; trackbar1.orientation: = trhorizontal; end.
Example 3:
Example 3 code:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, comctrls, extctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; Panel1: tpanel; Procedure formcreate (Sender: tobject); Procedure trackbar1change (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure alert (Sender: tobject); begin alert: = false; trackbar1.min: = 1; trackbar1.max: = clientwidth; trackbar1.position: = clientwidth Div 2; trackbar1.height: = 23; panel1.left: = 0; end; Procedure tform1.trackbar1change (Sender: tobject); begin panel1.width: = trackbar1.position; end.