這是一個非常古老的錯誤,當您激活CheckBoxes屬性將禁用TListView控件上的LVS_EX_SUBITEMIMAGES和 LVS_EX_INFOTIP樣式。
您可以使用此解決方法修復此錯誤。
1)禁止在ListView
2)在您的形式將這個代碼(在Delphi 7測試和Windows 7)的複選框屬性。
const
LVM_FIRST =$1000;
LVS_EX_SUBITEMIMAGES = $00000002;
LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55;
function ListView_GetExtendedListViewStyle(LVWnd: HWnd): DWORD;
begin
Result := SendMessage(LVWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
end;
function ListView_SetExtendedListViewStyle(LVWnd: HWnd; ExStyle: LPARAM): DWORD;
begin
Result := SendMessage(LVWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ExStyle);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.Checkboxes:=True;//Activate the checkbox in the listview
ListView_SetExtendedListViewStyle(ListView1.Handle,ListView_GetExtendedListViewStyle(ListView1.Handle) OR LVS_EX_SUBITEMIMAGES); //Activate the LVS_EX_SUBITEMIMAGES style.
end;
3)最終的結果是
alt text http://i50.tinypic.com/20hrfhd.png
據我知道你不能,因爲窗戶的標準控制本身使用圖片爲那些「複選框」有他們兩個,因此你將不得不老闆繪製每個列表項目 – zz1433 2010-02-25 19:58:28