如何在TListview控件上画图

解决方案 »

  1.   

    我也遇到了同样的问题,也不是在行开头,也不是在列开头,是以report方式列示时,在表格里用图片表示。
      

  2.   

    我收集到了  在ListView控件中绘底图 这个不知道是不是你要的  我也没试过 给你参考
    unit ListViewMain;interfaceuses
    Windows, Messages, SysUtils, Classes, Graphics, 
    Controls, Forms, Dialogs,
    ComCtrls, ImgList;
    type
    TForm1 = class(TForm)
    ListView1: TListView;
    ImageList1: TImageList;
    procedure ListView1CustomDraw(Sender:
    TCustomListView;
    const ARect: TRect; var DefaultDraw:
    Boolean);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; 
    var Action: TCloseAction);
    private
    { Private declarations }
    public
    { Public declarations }
    end;
    var
    Form1: TForm1;
    Bitmap1: TBitmap;
    implementation
    {$R *.DFM}procedure TForm1.ListView1CustomDraw(Sender: 
    TCustomListView;
    const ARect: TRect; var DefaultDraw: Boolean);
    var
    x,y,w,h : LongInt;
    begin
    with Bitmap1 do begin
    W := Width;
    H := Height;
    end;
    Y := 0;
    while Y < Height do begin
    X := 0;
    while X < Width do begin
    ListView1.Canvas.Draw(X, Y, Bitmap1);
    Inc(X, W);
    end;
    Inc(Y, H);
    end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
    Bitmap1 := TBitmap.Create;
    Bitmap1.LoadFromFile('backgray.bmp');
    end;procedure TForm1.FormClose(Sender: TObject; 
    var Action: TCloseAction);
    begin
    Bitmap1.Free;
    end;end.