代码说明:
垂直的listbox控件
Virtual listbox components .VirtList implements 2 "virtual listbox" components, TCustomVirtualListBox and TVirtualListBox, which are extensions of the owner-drawn listbox. These use the Windows 95 LBS_NODATA style to specify a no-data listbox. A no-data listbox is very similar to an owner-drawn listbox, except that Windows does not manage the data for the list: the listbox contains no item data. Using the class is simple: you drop the component on the form, specify the properties, and implement an OnDrawItem (TDrawItemEvent) procedure. This procedure is passed the line number to be drawn. It's up to you to decide what to draw. Typically, the line number will index a data structure maintained by your application. A no-data listbox does not have an Items property, because, well... that's the whole idea, isn't it? There is no Sorted property, either, because the no-data listbox doesn't know how to move items around. The virtual listbox has one important new property: Count. The value of Count determines how many items are displayed. It replaces Items.Count, which isn't accessable because the Items property isn't public/published. There is also a ScrollBars property, which is missing from the standard TListBox component. (Why?) By John Cardinal (mailto:JCardinal@ElmSquare.com)
【立即下载】
|