Delphi TListView(TListBox+图标显示)
Posted yishen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Delphi TListView(TListBox+图标显示)相关的知识,希望对你有一定的参考价值。
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.ImageList, Vcl.ImgList, Vcl.StdCtrls, Vcl.ComCtrls; type TForm1 = class(TForm) lv1: TListView; 添加: TButton; il1: TImageList; btn删除选中: TButton; 清空: TButton; btnDelete_select: TButton; procedure 添加Click(Sender: TObject); procedure btn删除选中Click(Sender: TObject); procedure btnDelete_selectClick(Sender: TObject); procedure 清空Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.添加Click(Sender: TObject); begin if lv1.Columns.Count = 0 then lv1.Columns.Add.Caption := ‘111‘; lv1.Column[0].width := 200; with lv1.Items.Add do begin StateIndex := 2; Caption := ‘Item‘ + IntToStr(lv1.Items.Count); end; end; procedure TForm1.清空Click(Sender: TObject); begin lv1.Clear; end; procedure TForm1.btnDelete_selectClick(Sender: TObject); begin lv1.Items[1].Delete; end; procedure TForm1.btn删除选中Click(Sender: TObject); begin lv1.Selected.Delete; end; end.
以上是关于Delphi TListView(TListBox+图标显示)的主要内容,如果未能解决你的问题,请参考以下文章