listview的viewstyle属性为vsReport想让每一行前面加上一个小图标,怎么弄?
解决方案 »
- Unit RzGroupBar was compiled with a different version of Graphics.clHotLight?
- vc 动态库中函数如何在DELPHI中声明与调用及参数传递
- 请问怎样改变当前目录到指定的目录?谢谢~
- ?有谁想要呢?
- 关于SQL语句的问题?
- EncodeLongword问题,请求帮助
- delphi listview打印
- 关于mts的问题,没有人用mts吗?
- 想中止WebBrowser控件正在下载的页面,stop()好像不起作用。应该怎么中止下载?
- 專利性技術難點!!=如何分離出圖像中的漢字及字母???
- [最新收获发布]TListView的ListItem完全自绘
- 关于事件的问题?
添加几个ListItem,设定大图标,ListView.viewstyle:=vsicon
下面是代码
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ImgList, ComCtrls;type
TForm1 = class(TForm)
fghd: TListView;
ImageList1: TImageList;
procedure fghdDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure fghdDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure fghdMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.fghdDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept:=Source is TlistView
end;procedure TForm1.fghdDragDrop(Sender, Source: TObject; X, Y: Integer);
var
PosPoint:TPoint;
begin
PosPoint.x:=x;
PosPoint.y:=Y;
(Source As TListView).Selected.SetPosition(PosPoint);
end;procedure TForm1.fghdMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button=mbleft then
begin
with sender as TListview do
begin
if GetItemAt(x,y)<>nil then
begindrag(false);
end;
end;
end;end.
Item: TListItem;
begin
Item := ListView1.Items.Add;
Item.Caption := 'test';
Item.ImageIndex := 1; //这里手工指定其图标编号
Item.SubItems.Add('test2');
end;