listview可不可以有背景图片,可以有的话,怎么弄!listview里的item可不可以响应双击事件,是在ondblclick事件里写的吗?可以的话,给点源码

解决方案 »

  1.   

    我这有个单击的 一样的
    procedure Tform_GCZL.TreeView_mainClick(Sender: TObject);
    var
      mystr:string;
      mystream:TMemoryStream;
    begin
      if TreeView_main.Selected=nil then Exit;
      if TreeView_main.Selected.AbsoluteIndex=0 then Exit;
      if (TreeView_main.Selected.ImageIndex=1) or (TreeView_main.Selected.ImageIndex=2) then
      begin
        if OleContainer_sys.State<>osEmpty then
        begin
          OleContainer_sys.DestroyObject;
          Exit;
        end;
      end;
      Screen.Cursor:=crHourGlass;
      //saveole;
      mystr:=getBG_ID(TreeView_main.Selected.AbsoluteIndex);
      with myadoq do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select * from mulu_file where BG_ID='''+mystr+''' and isfile=1');
        Open;
        if RecordCount>0 then
        begin
          mystream:=TMemoryStream.Create;
          TBlobField(Fieldbyname('BG_FILE')).SaveToStream(mystream);
          mystream.Position:=0;
          OleContainer_sys.LoadFromStream(mystream);
          Screen.Cursor:=crDefault;
        end;
      end;
      Screen.Cursor:=crDefault;
    end;
      

  2.   

    listview可不可以有背景图片,可以有的话,怎么弄!
    ---------------
    可以的,自己画
      

  3.   

    http://search.csdn.net/Expert/topic/257/257470.xml?temp=.4395258
      

  4.   

    item的双击可以在mousedown事件中加以处理
      

  5.   

    做背景图代码:
    unit ListViewMain;
    interface
    uses
    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. 
      

  6.   

    响应代码:
    procedure TForm1.ListView4DblClick(Sender: TObject);
    begin
     if ListView4.Selected=nil then exit;
     case ListView4.Items.IndexOf(ListView4.Selected) of
     0:Label8.Caption:=ListView4.Selected.Caption;
     1:Label8.Caption:=ListView4.Selected.Caption;
     2:Label8.Caption:=ListView4.Selected.Caption;
     3:Label8.Caption:=ListView4.Selected.Caption;
     4:Label8.Caption:=ListView4.Selected.Caption;
     end;
    end;
      

  7.   

    我也在搞这个问题,,哪位大哥比较懂的话可以帮我看看我的问题吗??
    贴子:http://community.csdn.net/Expert/topic/3335/3335955.xml?temp=.9686701