Thema: Delphi Custom list item drawing

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Custom list item drawing

  Alt 10. Feb 2010, 14:09
I want to draw custom list. First line is bolded string, if is last item, should draw additional line in normal style, simple:

Delphi-Quellcode:
begin
  if Control is TCheckListBox then
  begin
    with TCheckListBox(Control) do
    begin
      Canvas.FillRect(Rect);

      Canvas.Font.Style := [fsBold];
      Canvas.TextOut(Rect.Left + 4, Rect.Top + 4, Items[Index]);

      if Index = Count - 1 then
      begin
        Canvas.Font.Style := [];
        Canvas.TextOut(Rect.Left + 4, Rect.Top + 21, OpenPictureDialog.FileName);
      end;
    end;
  end;
end;
But it's simple in theory only. This code changing font style only and drawind only Items[I] in default position. What to do to get result I want?
  Mit Zitat antworten Zitat