All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
delphi高级vcl组件表头组件(THeaderControl)使用实例

Writer: aaa Article type: Programming skills(编程技巧) Time: 2014/7/19 0:13:58 Browse times: 326 Comment times: 0

delphi高级vcl组件表头组件(THeaderControl)使用实例


Head photo

Go homepage
Upload pictures
Write articles

delphi高级vcl组件表头组件(THeaderControl)使用实例

表头组件(THeaderControl)
THeaderControl 组件提供了一系列可改变尺寸的列,一般与列表框配合使用,用于把列表框中的信息归类。该组件可以分成几节,用户可以使用光标调整节的宽度或者把节拖到另一个位置,拖动时将触发节拖动事件(OnSectionTrack)。THeaderControl 组件提供了标准的头元素,程序运行时操作表头并不会影响它下面的组件。比如,当表头改变尺寸时,它下面组件的列也应该随之改变,此时,开发者必须响应THeaderControl 组件的尺寸改变事件(OnSetionResize),通过编写代码才能达到这一目的。
THeaderControl 组件具体用法的介绍如下。
1.THeaderControl 组件的重要属性
·Canvas 返回整个表头组件的画布
·FullDrag 当用户拖动表头的节时,表头将刷新
·DragReorder 允许用户通过拖放操作来改变节的顺序
·HotTrack 当光标指向表头的某节时,该节的标签将突出显示
·Images 用于指定一个图像列表
·Sections 可以访问表头组件中所有的节
·Style 用于设置表头组件的风格
下面介绍程序中THeaderControl 组件的常用属性。
(1)Images 属性
用于指定一个图像列表,其中的图像将显示在节的标签旁边。每个节(THeadSection 对象)通过它的ImageIndex 属性指定一个图像。
(2)Sections 属性
此属性可以访问表头组件中所有的节。例如要在运行期动态地增加一节,程序示例代码如下:
var
MyHeadSection:TheadSection
begin
HeaderControl1.Section1.Items.Clear;
MyHeadSection:=HeaderControl1.Sections.Items.Add;
HeaderControl1.Sections.Items[0].Text:=?MySection?;
HeaderControl1.Sections.Items[0].Width:=100;
ends;
(3)Style 属性
此属性用于设置表头组件风格,默认值是hsButtons。若设为hsFlat,表头的节(按钮)是平坦的。
它有如下两个用户可选值。
·hsFlat:表头的节是平坦风格的。
·hsButton:表头的节是按钮风格的。





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.