Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCheckListbox.Drawitem problem

Status
Not open for further replies.

martinm

IS-IT--Management
Mar 30, 2001
113
GB
I've a problem with this. Only the first (item 0) row gets visibly drawn. The others are drawn (output to console window). If the list is scrolled, the others become visible as they pass the first visible position.

I've had this before and fixed it, but can't remember how and the code is else where :(


procedure TfrmChgLstCnst.clbAvailableDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
clbAvailable.Canvas.FillRect(Rect);
clbAvailable.Canvas.TextRect( Rect, 25, 0, clbAvailable.Items[index]);

writeln(inttostr(index), clbAvailable.Items[index]);
end;

 
Sorted!

clbAvailable.Canvas.TextRect( Rect, 25, 0, clbAvailable.Items[index]);


Used
clbAvailable.Canvas.TextOut( Rect.Left + 25, Rect.Top, clbAvailable.Items[index]);

I think the '0' should have been rect.top (i.e. was the parent top, not top within the rect.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top