procedure TSkinListView.DrawHeaderItem(WinHandle: hWnd;
Dc: Hdc;
Index: Integer; Rect: TRect;
Selected: Bool);
var
Text: PWideChar;
buf:
array [0 .. 255]
of Char;
Item: THDItem;
rcHeader: TRect;
Img: Cardinal;
Graphics: Cardinal;
rc: TRect;
rw: TRect;
lP: TPoint;
begin
Item.mask := HDI_TEXT
or HDI_FORMAT
{ or HDI_BITMAP } or HDI_WIDTH;
Item.pszText := buf;
Item.fmt := HDF_LEFT
or HDF_OWNERDRAW
{ or HDF_BITMAP } or HDF_STRING;
Item.cchTextMax := sizeof(buf);
Header_GetItemRect(WinHandle,
Index, @rcHeader);
ZeroMemory(@buf, sizeof(buf));
Header_GetItem(WinHandle,
Index, Item);
Text := buf;
SetBkMode(
Dc, TRANSPARENT);
if GetShadow
then
begin
if IsWindowEnabled(WinHandle)
then
Color := GetShadowColor
else
Color :=
RGB(255, 255, 255);
Rect.Top := (((rcHeader.Bottom - FPointSize)
div 2)
div 2 + 1);
DrawTextToDC(
Dc, Text, Rect, Color, FFontName, FPointSize, FFontStyle, 0, 0);
if IsWindowEnabled(WinHandle)
then
begin
if Selected
then
Color := AktForecolor
else
Color := InAktForecolor;
end
else
Color :=
RGB(140, 140, 140);
DrawTextToDC(
Dc, Text, Rect, Color, FFontName, FPointSize, FFontStyle, FShadowOffset, 0);
if GdipCreateFromHDC(
Dc, Graphics) = OK
then
begin
Img := Cardinal(GetProperty(
Handle, PROP_IMAGE_SELECTED));
GetClientRect(WinHandle, rc);
GetWindowRect(WinHandle, rw);
lP.x := rw.Left;
lP.y := rw.Top;
ScreenToClient(GetParent(
Handle), lP);
SkinEngine.PaintButton(Graphics, 4, Img, rc.Left, rc.Top, rc.Right, rc.Bottom, BS_PUSHBUTTON);
SkinEngine.PaintButton(Graphics, 4, Img, rcHeader.Left, rcHeader.Top,
rcHeader.Right - rcHeader.Left, rcHeader.Bottom, BS_PUSHBUTTON);
GdipDeleteGraphics(Graphics);
end;
end;
end;