本例效果图:

代码文件:


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls; type
  TForm1 = class(TForm)
    ListView1: TListView;
    Button1: TButton;
    Button2: TButton;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
  end; var
  Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject);
begin
  ListView1.Align := alLeft;
  Button1.Caption := '添加';
  Button2.Caption := '清空';
  RadioButton1.Caption := 'ViewStyle = vsIcon';
  RadioButton2.Caption := 'ViewStyle = vsList';
  RadioButton3.Caption := 'ViewStyle = vsReport';
  RadioButton1.Checked := True;
end; procedure TForm1.Button1Click(Sender: TObject);
var
  item: TListItem;
begin
  item := ListView1.Items.Add;
  item.Caption := 'Item' + IntToStr(ListView1.Items.Count);
end; procedure TForm1.Button2Click(Sender: TObject);
begin
  ListView1.Clear;
end; procedure TForm1.RadioButton1Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsIcon; {这是默认值}
end; procedure TForm1.RadioButton2Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsList;
end; procedure TForm1.RadioButton3Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsReport;
  if ListView1.Columns.Count = then ListView1.Columns.Add.Caption := '标题';
end; end.

窗体文件:


object Form1: TForm1
  Left =
  Top =
  Caption = 'Form1'
  ClientHeight =
  ClientWidth =
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch =
  TextHeight =
  object ListView1: TListView
    Left =
    Top =
    Width =
    Height =
    Columns = <>
    TabOrder =
  end
  object Button1: TButton
    Left =
    Top =
    Width =
    Height =
    Caption = 'Button1'
    TabOrder =
    OnClick = Button1Click
  end
  object Button2: TButton
    Left =
    Top =
    Width =
    Height =
    Caption = 'Button2'
    TabOrder =
    OnClick = Button2Click
  end
  object RadioButton1: TRadioButton
    Left =
    Top =
    Width =
    Height =
    Caption = 'RadioButton1'
    TabOrder =
    OnClick = RadioButton1Click
  end
  object RadioButton2: TRadioButton
    Left =
    Top =
    Width =
    Height =
    Caption = 'RadioButton2'
    TabOrder =
    OnClick = RadioButton2Click
  end
  object RadioButton3: TRadioButton
    Left =
    Top =
    Width =
    Height =
    Caption = 'RadioButton3'
    TabOrder =
    OnClick = RadioButton3Click
  end
end

 

使用 TListView 控件(2)的更多相关文章

  1. Delphi的TListView控件拖放选定行操作

    http://www.tansoo.cn/?p=401 Delphi的TListView控件拖放选定行操作的例子,效果图如下:TListView控件拖动选定行到指定位置 具体实现步骤: 一.新建一个D ...

  2. c++ builder TListView控件按字符串排序(根据网上代码亲测ok)

    //--------------------------------------------------------------------------- /* 首先将一个列表框控件安放在Form上, ...

  3. 使用 TListView 控件(4)

    本例效果图: 代码文件: unit Unit1; interface uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, ...

  4. TListView控件的ReadOnly属性的一个Bug

    不知道是不是ListView的 ReadOnly属性的一个bug 1.Form上一个ListView,如图设置 2.在FormCreate事件中写如下代码:     ListView1->Rea ...

  5. 教程-Delphi第三方控件安装卸载指南

    1 只有一个DCU文件的组件.DCU文件是编译好的单元文件,这样的组件是作者不想把源码公布.一般来说,作者必须说明此组件适合Delphi的哪种版本,如果版本不对,在安装时就会出现错误.也正是因为没有源 ...

  6. Delphi 7 里没有加载的控件

    在原来版本如D5.D6中使用的控件如Quickrep,FastNet等,在D7中仍然是保留的.只是Delphi没有将他们默认的安装到组件面版中来.这些控件包全部保存在Delphi目录的bin下,文件扩 ...

  7. 教程-Delphi7 自带控件安装对应表

    原来的控件delphi7里何处寻? 经常有朋友提这样的问题,“我原来在delphi5或者delphi6中用的很熟的控件到哪里去了?是不是在delphi7中没有了呢?这是不是意味着我以前写的代码全都不能 ...

  8. Delphi中解析Xml的控件-SimDesign NativeXml

    Delphi中解析Xml的控件-SimDesign NativeXml 正在学习,感觉应用很方便.无源代码的版本还是免费的. SimDesign.NativeXml是一个delphi和bcb的XML控 ...

  9. Delphi在Listview中加入Edit控件

    原帖 : http://www.cnblogs.com/hssbsw/archive/2012/06/03/2533092.html Listview是一个非常有用的控件,我们常常将大量的数据(如数据 ...

随机推荐

  1. 【PTA 天梯赛】L2-016. 愿天下有情人都是失散多年的兄妹(深搜)

    呵呵.大家都知道五服以内不得通婚,即两个人最近的共同祖先如果在五代以内(即本人.父母.祖父母.曾祖父母.高祖父母)则不可通婚.本题就请你帮助一对有情人判断一下,他们究竟是否可以成婚? 输入格式: 输入 ...

  2. ABAP术语-Distribution Model

    Distribution Model 原文:http://www.cnblogs.com/qiangsheng/archive/2008/01/25/1052434.html Model that d ...

  3. Spirng+SpringMVC+Mybatis(一)

    实习之后都是在别人搭配好环境的情况下进行一些业务的编写,脑袋已经不记得如何搭建一个ssm项目的,所以周末有空补了一下. 首先新建一个test数据库,并且在里面插入三条数据.如图下 编写一个User B ...

  4. SQL中EXCEPT函数在 Mysql 和 sqlServer 中的替代方法

    示例摘自:极客代码:http://wiki.jikexueyuan.com/project/sql/useful-functions/except-clause.html EXCEPT 子句 EXCE ...

  5. chrome debugger 调试

    debugger 使用chrome调试时,html页面的js代码中可能不好打断点(因为在jvm中才会有代码) 我一开始是故意在需要断点的后面或前面写个错的alert,通过jvm找到此处,然后在需要的地 ...

  6. 一次 group by + order by 性能优化分析

    一次 group by + order by 性能优化分析 最近通过一个日志表做排行的时候发现特别卡,最后问题得到了解决,梳理一些索引和MySQL执行过程的经验,但是最后还是有5个谜题没解开,希望大家 ...

  7. doc命令操作数据库(下)

    1.给数据表添加一组数据: 2.给数据表添加多组数据: 3.对数据进行删除和修改: 4.用select查询单个或多个数据信息: 5.去除重复值: 6.查询的各种用法: between的用法: 查询排序 ...

  8. 2019-04-10 python入门学习——教材和工具准备

    # 从决定学习编程语言到正式做出计划挤出空余时间,历经一年半,因工作原因及生活原因不断搁浅,从湖北到浙江再回湖北,暂时稳定在一家小公司,从日常加班中压缩时间学习,于此记录学习进度.学习问题,在此过程中 ...

  9. mysql日志管理#慢日志详解

    MySQL的慢查询日志是MySQL提供的一种日志记录,它用来记录在MySQL中响应时间超过阀值的语句,具体指运行时间超过long_query_time值的SQL,则会被记录到慢查询日志中 long_q ...

  10. 001---Linux系统的启动过程

    Linux系统的启动过程 按下电源 开机自检(BIOS):检查cpu.内存.硬盘是否有问题,找到启动盘. MBR引导(master boot record):主引导记录,读取存储设备的512bytes ...