Jeg bryggede lige dette her sammen. Husk at sætte TCheckListBoksens style = lbOwnerDataVariable.
procedure TfrmMain.CheckListBox1MeasureItem(Control: TWinControl; Index: Integer; var Height: Integer);
var
St : string;
Rect : TRect;
CheckListBox : TCheckListBox;
begin
CheckListBox := (Control as TCheckListBox);
St := CheckListBox.Items[Index];
Rect.Left := 16;
Rect.Right := CheckListBox.Width - Rect.Left;
DrawText(CheckListBox.Canvas.Handle,pchar(st),length(st),Rect,DT_LEFT or DT_WORDBREAK or DT_CALCRECT);
Height := Rect.Bottom - Rect.Top;
end;
procedure TfrmMain.CheckListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
St : string;
CheckListBox : TCheckListBox;
begin
CheckListBox := (Control as TCheckListBox);
St := CheckListBox.Items[Index];
DrawText(CheckListBox.Canvas.Handle,pchar(st),length(st),Rect,DT_LEFT or DT_WORDBREAK);
end;
Se i øvrigt mere om emnet på:
http://homepages.borland.com/efg2lab/Graphics/CircleWordWrap.htm eller læs onlinehjælpen om DrawText.