码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi TListView(TListBox+图标显示)

时间:2018-09-30 20:41:50      阅读:1093      评论:0      收藏:0      [点我收藏+]

标签:rap   graphic   winapi   interface   ctc   select   messages   image   div   

技术分享图片

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+图标显示)

标签:rap   graphic   winapi   interface   ctc   select   messages   image   div   

原文地址:https://www.cnblogs.com/YiShen/p/9733240.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!