当前位置:网站首页>[3.delphi common components] 6 scroll bar

[3.delphi common components] 6 scroll bar

2022-06-11 02:12:00 Janeb1018

6. Scroll bar

In general , Scrollbars are added automatically . If you plan to control the scrolling of the window by yourself , You can use the scroll bar (TScrollBar) Components . Its main properties are as follows :

attribute explain
LargeChange Set when the user clicks the scroll bar ( Non arrow part ) Rolling distance
Max Maximum scrollable value
Min Minimum scrollable value
PageSize Press down PgUp、PgDn The scrolling distance of the scroll bar when pressing the key
Position Sets or returns the position of the square in the scroll bar
SmallChange Click the arrows at both ends of the scroll bar to scroll the distance

The main method :

Method explain
SetParams This procedure is used to set Position、Max and Min attribute

Major events :

event explain
OnScroll Event triggered when the user operates the scroll bar , among , The second parameter returns the status of the scroll bar , The third parameter returns the position of the scroll bar box

Example : Display the current position when the square position of the scroll bar changes , The interface is as follows :

 

The code is as follows :

procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
  var ScrollPos: Integer);
begin
  Label1.Caption := ' The current position :' + IntToStr(ScrollBar1.Position);
end;
原网站

版权声明
本文为[Janeb1018]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020617548305.html