procedure TForm3.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);begin with (Control as TListBox).Canvas do // draw on control canvas, not on the form begin Brush.Style := bsSolid; if Index = 3 then Brush.Color := clRed else Brush.Color := clBlack; Rectangle(Rect); Brush.Style := bsClear; // display the text TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]); end;end;
It was saying "windows" identifier not found. & wrong number of parameters specified to call to "Rect". After change at least 1st problem went away. Still have call to "Rect" problem.