ListView - 所选单元格的绘图不正确

时间:2017-02-02 10:08:01

标签: listview winapi

如果ListView使用标准绘图处理,它看起来像这样: standard drawing processing

但是,如果我处理消息 NM_CUSTOMDRAW 并且在 CDDS_SUBITEM ||中CDDS_ITEMPREPAINT 更改 clrTextBk ,它看起来像这样: process the message NM_CUSTOMDRAW

//
if pnm^.code = NM_CUSTOMDRAW then
//
if not TblListViewFieldIsCreate then
begin
//
LPNMLVCD:=LPNMLVCUSTOMDRAW(lPrm);

//
  case LPNMLVCD^.nmcd.dwDrawStage of
...

//
CDDS_SUBITEM or CDDS_ITEMPREPAINT:
    begin
//
if ListViewItemSel = LPNMLVCD^.nmcd.dwItemSpec then
      begin
//
if LPNMLVCD^.iSubItem = ListViewSubItemSel then
        begin
//
LPNMLVCD^.clrText:=GetSysColor(COLOR_HIGHLIGHTTEXT);

//
LPNMLVCD^.clrTextBk:=GetSysColor(COLOR_HIGHLIGHT);
        end
//
else
        begin
//
LPNMLVCD^.clrText:=0;
//
LPNMLVCD^.clrTextBk:=$d8e9ec;
        end;

//
Result:=CDRF_NEWFONT;

//
Exit;
      end;
    end; 
  end;
end;

我需要做些什么才能像标准一样绘制所选单元格?

0 个答案:

没有答案