
11.12.2012, 02:08
|
 |
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
Ну понятно.
в Util.pas добавить
Код:
procedure DSFillRect(DC : HDC; const Rect : TRect; Color : TColorRef);
...
procedure DSFillRect(DC : HDC; const Rect : TRect; Color : TColorRef);
var
Brush : HBRUSH;
begin
Brush := CreateSolidBrush(Color);
try
Windows.FillRect(DC, Rect, Brush);
finally
DeleteObject(Brush);
end;
end;
в dpr добавить
Код:
procedure ListViewDrawItem(lpdis : PDRAWITEMSTRUCT);
var
aRect : TRect;
begin
aRect := lpdis.rcItem;
DSFillRect(lpdis.hDC, aRect, clWhite);
if Integer(lpdis.itemID + 1) > LV_GetTopIndex(PlayList) + LV_GetVisibleRowCount(PlayList) then
Exit;
if ((lpdis.itemState and CDIS_SELECTED) = CDIS_SELECTED) then
begin
DSFillRect(lpdis.hDC, aRect, clLime);
SetTextColor(lpdis.hDC, clWhite);
SetBkColor(lpdis.hDC, clLime);
end
else
SetTextColor(lpdis.hDC, clBlack);
aRect := LV_GetSubItemRect(PlayList, lpdis.itemID, 0, lvLabel);
DrawText(lpdis.hDC, PChar(Format('%d.', [lpdis.itemID + 1])), -1, aRect, DT_RIGHT or DT_VCENTER);
aRect := LV_GetSubItemRect(PlayList, lpdis.itemID, 1, lvLabel);
aRect.Left := aRect.Left + 4;
DrawText(lpdis.hDC, PChar(LV_GetItemText(PlayList, lpdis.itemID, 1)), -1, aRect, DT_VCENTER or DT_END_ELLIPSIS);
end;
...
function WindowProc(Wnd: HWND; Msg, wParam, lParam: Integer): Integer; stdcall;
...
case Msg of
...
WM_DRAWITEM :
begin
if PDRAWITEMSTRUCT(lParam)^.CtlType = ODT_LISTVIEW then
ListViewDrawItem(PDRAWITEMSTRUCT(lParam));
end;
...
Util.pas возьми тот, в котором были прописаны константы цветов.
Здесь нет выделения жирным шрифтом, выделяется цветом.
|