当前位置:主页>Delphi教程>文章内容
如何制作平面式列头的Listview
来源: 作者: 发布时间:2007-04-29  

如何制作平面式列头的Listview

 

新建一应用程序,在窗体上放置一个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.


 
上一篇:编辑框和位图按钮的特殊结合   下一篇:在TDBGrid控件中为作修改过的记录进行标识!
 
  相关文章
·编辑框和位图按钮的特殊结合
·在TDBGrid控件中为作修改过的记录进行
·开发一个密码查看器
·建立、读取、存贮INI文件的方法《一》
·纸牌控件的编写(下)
·一个值得大家来考虑的DLL问题
·在Delphi中开发使用多显示器的应用程序
·DLL全局钩子
·纸牌控件的编写(中)
·建立、读取、存贮INI文件的方法《二》
·delphi连接数据库浅谈
·建立、读取、存贮INI文件的方法《三》
 
【关闭窗口】
推荐本站资源
最新文章