电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> delphi技术>>制作平面式列头的Listview:

制作平面式列头的Listview

来源:远方网络 | 2005-12-31 9:51:04 | (有1781人读过)

新建一应用程序,在窗体上放置一个ListView控件和一个按钮控件,然后粘贴以下代码,代码中的有关API和常量参考Windows单元,方法是按是Ctrl键,然后单击鼠标左键

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ComCtrls;

type

TForm1 = class(TForm)

ListView1: TListView;

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

const

LVM_GETHEADER = $1000 + 31;

var

hHeader: THandle;

style: dWord;

begin

hHeader := SendMessage(ListView1.Handle, LVM_GETHEADER, 0, 0);

style := GetWindowLong(hHeader, GWL_STYLE);

style := style xor $2;

SetWindowLong(hHeader, GWL_STYLE, style);

SetWindowPos(ListView1.Handle, Form1.Handle, 0, 0, 0, 0,SWP_NOZORDER or SWP_NOSIZE or SWP_NOMOVE or SWP_DRAWFRAME);

end;

end.

delphi技术热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号