Ver Mensaje Individual
  #2  
Antiguo 06-09-2005
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Hola,

Te iba a remitir a este hilo pero ¿qué crees?

En el código de ese hilo adapta el método WMNotify así:


Código Delphi [-]
procedure TListView.WMNotify(var Msg: TWMNotify);
var
  Header: HWnd;
  CustomDraw: PNMCustomDraw;
  HeaderFont: TFont;

begin
  // obtener el identificador del header
  Header := Perform(LVM_GETHEADER, 0, 0);

  if (Msg.NMHdr.code = NM_CUSTOMDRAW) and (Msg.NMHdr.hwndFrom = Header) then
  begin
    // estructura de datos con información para el pintado
    CustomDraw := PNMCustomDraw(Msg.NMHdr);

    case CustomDraw.dwDrawStage of
      CDDS_PREPAINT:
        // se le dice a Windows que queremos notificaciones para cada item
        Msg.Result := CDRF_NOTIFYITEMDRAW;

      CDDS_ITEMPREPAINT:
        (*
          dwItemSpec es el índice del item del encabezado (columna)
          que queremos pintar- en este caso 1
        *)

        if CustomDraw.dwItemSpec = 1 then
        begin
          HeaderFont := TFont.Create;

          try
            HeaderFont.Style := [fsBold];
            Windows.SelectObject(CustomDraw.hdc, HeaderFont.Handle);
            Windows.SetTextColor(CustomDraw.hdc, clBlue);

            //Windows.SetBkColor(CustomDraw.hdc, $00FF8080);
          finally
            HeaderFont.Free;
          end;
        end;
    end;
  end;
end;

// Saludos
Responder Con Cita