Delphi Tscrollbar for scrolling windows, component content

Source: Internet
Author: User

ScrollBar Component (Tscrollbar) This component is a Windows scroll bar for scrolling windows, component content. Many controls have scroll bar properties, which take the scroll bar as part of their own, and the Tscrollbar component provides an additional feature for controlling the absence of a full scrollbar, which makes certain controlled content easy to manipulate.

1. Typical usage of Tscrollbar components

In general, scrollbars are automatically added, such as the list box that is mentioned earlier, and when items are not fully displayed, the list box is automatically added to the scroll bar. The list scrolls automatically when the user operates the scroll bar.

If you want to manipulate the window to scroll, you need to use the Tscrollbar component, when the user on the scroll bar operation, will trigger the Onscroll event, so you can manipulate how to scroll.

In general, users only take advantage of the Onscroll event and reference the Position property in code to get the location of small squares of the Tscrollbar component, and then manipulate it with this value, such as setting the font size, color values, and so on.

2. Important properties of Tscrollbar components

Kind---------This property to set whether the scroll bar is horizontal or vertical
largechange--set the distance to scroll the scroll bar

Max------------This property to set the final value of the scroll bar
Min------------This property is used to set the starting value of the scroll bar
PageSize-------When you press the PgUp or PgDn key, set the distance the scroll bar scrolls position set or return the position of the small square of the scrollbar
SmallChange----The distance the scroll bar scrolls when the user presses the arrows at both ends of the scroll bar

(1) Kind property
The kind property is used to set whether the scroll bar is horizontally or vertically oriented. It has a value of two:
. Sbhorrizontal: Horizontal direction;
. Sbvertical: Vertical direction.

(2) LargeChange property
When the user clicks inside the scrollbar (not the arrows at both ends of the scroll bar), the distance that the scrollbar scrolls is set by the LargeChange property, which by default is
1, this is a relative number. Assuming that the LargeChange property is set to 10, if the Max property is minus the Min property of 80, the user can scroll from one end to the other by pressing 8 scrollbars.

(3) Max property and Min property
These two properties are used to set the final and starting values of the scroll bar, respectively, with values between 2147483648 and 2147483647.
The Max property value must be greater than the Min property, and must be a 0 or a positive integer.

(4) PageSize property
When the user presses the PgUp or PgDn key, the distance the scroll bar scrolls is set by the PageSize property, which defaults to 1.

(5) Position property
The Position property is used to set or return the position of a small square of a scrollbar, you can set the starting position of the smaller square specified by the Position property at the design time, or you can modify the Position property at run time to make the scroll bar scroll.

(6) SmallChange Property
The SmallChange property is similar to the LargeChange property, but it is the distance that the scroll bar scrolls when the user presses the arrows at each end of the scrollbar, and the default value is 1.

3. Important events of Tscrollbar components

OnChange-------------user to manipulate scrollbars or to modify directly by programming
Position the value of the-------------property, which will trigger the event
Onscroll-------------This event is triggered when the user operates the scroll bar

(1) onchange Event
The event is triggered by the user manipulating the scroll bar or by programmatically modifying the value of the Position property.
The Onscroll event occurs only when the user operates the scroll bar, and the onchange event occurs after the Onscroll event.

(2) Onscroll Event
This event is triggered when the user operates the scroll bar. Where the Scrollpos parameter returns the position of the small square of the scrollbar Scrollcode parameter returns the state of the scroll bar. Can be the following values.
. Sclineup: The user presses the left or up arrow of the scroll bar or the up direction key on the keyboard.
. Sclinedown: The user presses the right or down arrow of the scroll bar or the down direction key on the keyboard.
. Scpageup: The user clicks the area on the left or top of a small square within the scrollbar or presses the PgUp key.
. Scpagedown: The user clicks the right or bottom area of a small square within the scrollbar or presses the PGDN key.
. Scposition: The user drags a small square within the scrollbar and is released.
. Sctrack: The user is dragging a small square.
. Sctop: The user moves the small square to the top or left side of the scrollbar.
. Scbottom: The user moves the small square to the lower or right end of the scroll bar.
. Scendscroll: The user has released the mouse or key after manipulating the scroll bar.

Delphi Tscrollbar for scrolling windows, component content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.