Hi All,
I've been playing around with a CheckListBox.. It does everything I need for what I'm doing but I'm having problem getting the Font I want.. Basically I want a fixed width font
I'm attempting to change the font in the FormCreate ...
procedure TMyForm.FormCreate(Sender: TObject);
begin
with CheckListBox1.Font do
begin
Pitch := fpFixed;
Name := 'Lucida Console';
Style := [];
end;
....
It's doesn't make any difference.
If I set the CheckListBox style to lbOwnerDrawFixed with a OnDrawItem...
procedure TMyForm.CheckListBox1DrawItem(Control: TWinControl; Index: integer; ARect: TRect; State: TOwnerDrawState);
var
Flags: longint;
begin
with (Control as TCheckListBox) do
begin
Canvas.FillRect(ARect);
Flags := DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX;
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), ARect, Flags);
end;
end;
Then the font change works, but the Checkboxes disappear.
I have no idea what those flags mean. This is a stripped down example I found for change the Font colour
Does anyone have any idea how I might otherwise change the font and keep the checkboxes ?
Thanks in advance