Ver Mensaje Individual
  #3  
Antiguo 15-03-2013
Avatar de Chris
[Chris] Chris is offline
Miembro Premium
 
Registrado: abr 2007
Ubicación: Jinotepe, Nicaragua
Posts: 1.678
Reputación: 19
Chris Va por buen camino
Aunque la forma sugerida por Neftalí es valida, tengo otra alternativa.

Primero, establece la propiedad Style del CheckListBox a lbOwnerDrawFixed. Luego en el evento OnDrawItem utilizá un código similar a este:

Código Delphi [-]
procedure TForm2.CheckListBox1DrawItem(Control: TWinControl;
                                       Index: Integer;
                                       Rect: TRect; State: TOwnerDrawState);
var
    DrawingRect: TRect;
    DrawText: String;
begin
    DrawingRect := Rect;
    DrawText := TCheckListBox(Control).Items[Index];

    with TCheckListBox(Control).Canvas do
    begin
        if Index = 0 then // Condición para pintar elementos tachados
        begin
            Font.Style := [fsStrikeOut];
        end;

        FillRect(Rect);
        Inc(DrawingRect.Left, 3); // dejar 3px de margen entre el texto y el Checkbox
        TextRect(DrawingRect, DrawText);
    end;
end;

El código anterior tachará el texto del primer elemento de la lista.

Saludos.
__________________
Perfil Github - @chrramirez - Delphi Blog - Blog Web
Responder Con Cita