关于listview的两个问题!

lusifer001 2004-09-01 11:01:43
listview可不可以有背景图片,可以有的话,怎么弄!

listview里的item可不可以响应双击事件,是在ondblclick事件里写的吗?可以的话,给点源码
...全文
150 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wo_ai_laopo 2004-09-03
  • 打赏
  • 举报
回复
我也在搞这个问题,,哪位大哥比较懂的话可以帮我看看我的问题吗??
贴子:http://community.csdn.net/Expert/topic/3335/3335955.xml?temp=.9686701
jl820712 2004-09-03
  • 打赏
  • 举报
回复
关注!!!
江宁侯哥 2004-09-01
  • 打赏
  • 举报
回复
http://search.csdn.net/Expert/topic/257/257470.xml?temp=.4395258
江宁侯哥 2004-09-01
  • 打赏
  • 举报
回复
listview可不可以有背景图片,可以有的话,怎么弄!
---------------
可以的,自己画
delphiseabird 2004-09-01
  • 打赏
  • 举报
回复
我这有个单击的 一样的
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;
zdq801104 2004-09-01
  • 打赏
  • 举报
回复
代码都给了,记得给分哦
zdq801104 2004-09-01
  • 打赏
  • 举报
回复
响应代码:
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;
zdq801104 2004-09-01
  • 打赏
  • 举报
回复
做背景图代码:
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.
BigAngell 2004-09-01
  • 打赏
  • 举报
回复
楼上几位不错,快去试试吧
iBear 2004-09-01
  • 打赏
  • 举报
回复
item的双击可以在mousedown事件中加以处理

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧