Delphi's list box component (Tlistbox)

Source: Internet
Author: User

Tlistbox Component Properties

AutoComplete

Sets whether to move the focus to the user's keyboard input option

BorderStyle

Set whether the component has a border

Canvas

Provides a drawing panel.

Columns

Specify the number of visible columns for a list box

Count

Get the number of component options for a list box

Extendedselect

Whether you can select a range of options in the list box

IntegralHeight

Sets whether the list box partially displays the options that are not fully displayed

ItemHeight

Set the height of a list box

Items

Set all options for a list box

MultiSelect

Whether to use the multiple selection feature

ScrollWidth

Specify the width of the list box

Seltcount

Returns the total number of current options

Sorted

Set list box options to release alphabetical order

Style

Set the style of a list box

Tabwidth

Set the tab width

TopIndex

Set the index number at the top of the option

Example: Automatically get the component focus in a list box

var Key:word;  Shift:tshiftstate); var   i:integer;begin   for1 to Length (Trim (edit1.text)) do     SendMessage (Listbox1.handle,wm_char,integer (Edit1.text[i]),0);  SendMessage (Listbox1.handle,wm_char,integer (Key),0); end;end.

Example drawing with canvas properties

procedure Tform1.listbox1drawitem (Control:twincontrol;  Index:integer; Rect:trect; State:townerdrawstate);varI:integer;begin with Control asTlistbox Dobegin Canvas.framerect (clientrect); ifodselectedinchState then begin Canvas.Brush.Color:=clred; Canvas.roundrect (Rect.left,rect.top,rect.right,rect.bottom,8, the);      SetBkMode (canvas.handle,transparent); Canvas.textout ((Rect.right-rect.left) Div2, Rect.top,items.strings[index]); EndElsebegin Canvas.Brush.Color:=Clskyblue; Canvas.roundrect (Rect.left,rect.top,rect.right,rect.bottom, the, the);    Canvas.textrect (Rect,rect.left,rect.top,items.strings[index]);  End End;end;end.

Example Blur find text

procedure Tform1.edit1change (sender:tobject); var   lindex:integer;begin  LIndex:=sendmessage (listbox1.handle,lb_selectstring,-1, Longint (Edit1.text)); end;end.

Delphi's list box component (Tlistbox)

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.