我想在listview所建立的表格最前面的一排加上button这样一选定一行,即会有一个三角形的箭头指向该选定行,再就是在第二排加上checkbox选项,当checkbox为真时即选中这一排中的数据,为下面的程序调用,可是不知怎样的在listview中加入这样的组件,并实现这样的功能,有知的高人可否指点一二,最好有完整的源代码,本人对于delphi还不是很熟,同时也看到一个例子,但是却不理解它前几行代码的意思,并且也编译不过,不知大家能否指点:部份源码如下:
type
PItemCtrl = ^TitemCtrl  //delphi根本就不认这个定义指针
PItemCtrl = record   //到这里就无法编译过去了,且没有";"也不解
CheckBox: TCheckBox;  
 Button: TButton;  
end;  end;    //这里又为何要用二个end
...
{$R *.dfm}procedure TfrmMain.ListView1CustomDrawSubItem(Sender: TCustomListView;Item: TListItem; SubItem: Integer; State: TCustomDrawState;var DefaultDraw: Boolean);
var
Rect: TRect;   P: PItemCtrl;
begin
{ 第2个子项目上显示CheckBox,第5个子项目上显示Button }
if SubItem in [2, 5] then
begin
DefaultDraw:= False; // 不显示默认的文本.
Rect:= Item.DisplayRect(drBounds); // 获取Item显示的区域.
if Item.Data = nil then // 如果为空则创建CheckBox及Button.
begin
new(P); // 创建一个指针用于存储CheckBox及Button. 
{ 创建并显示CheckBox }
P.CheckBox:= TCheckBox.Create(ListView1);
P.CheckBox.Parent:= ListView1;
P.CheckBox.Caption:= '';
P.CheckBox.Width:= 20;
P.CheckBox.Height:= 20;
P.CheckBox.Left:= Rect.Right - ListView1.Columns[3].Width
- ListView1.Columns[4].Width - ListView1.Columns[5].Width
- ((ListView1.Columns[2].Width + P.CheckBox.Width) div 2);
P.CheckBox.Top:= Rect.Top;
P.CheckBox.Visible:= True;
{ SubItems[2 -1].Caption为0和1,直接转换为Boolean型并给CheckBox赋值. }
P.CheckBox.Checked:= StrToBool(Item.SubItems[SubItem -1]);
{ 创建并显示Button }
P.Button:= TSpeedButton.Create(ListView1);
P.Button.Parent:= ListView1;
P.Button.Caption:= '...';
P.Button.Width:= 20;
P.Button.Height:= 20;
P.Button.Left:= Rect.Right - ((ListView1.Columns[5].Width
+ P.Button.Width) div 2);
P.Button.Top:= Rect.Top;
P.Button.Visible:= True;
Item.Data:= P; // 将CheckBox及Button的结构指针保存于Item.Data属性.
end;     end;        end;