Hmm... why did this take 2hrs to arrive?!?
Also, maybe I went overboard with the custom drawing stuff 8-)
Chris
> -Original Message-
> From: Chris Milham
> Sent: Monday, 23 September 2002 8:31 a.m.
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Highlig
Owner Draw?
> OK I give up. How do you HighLight a line of text in a ListBox?
>
> Kevin
>
> ---
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
You should be able to highlight individual items on the listbox by adding
code on the listbox's OnDrawItem event. If you want to simply change the
text color then do the following:
ListBox1.Canvas.Font.Color:= clRed;
ListBox.Canvas.TextOut(x,y, ListBox1.Items[index]);
if you want to hightli
Try ItemIndex := 1;
Stacey
> -Original Message-
> From: Kevin Parker [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 23 September 2002 12:20 a.m.
> To: Multiple recipients of list delphi
> Subject: [DUG]: Highlighting text in a ListBox
>
>
> OK I give up. How do you HighLight a line of te
Hi Kevin,
I just had a play. Try this
Set 'style' prop to 'lbOwnerDrawFixed'.
Add some items (I used 3).
Add this code to the 'OnDrawItem' event handler:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState);
begin
with listbox1.Can
At 12:19 am 23/09/02, you wrote:
>OK I give up. How do you HighLight a line of text in a ListBox?
>
>Kevin
Done with the ItemIndex property.
Simply set ListBox1.ItemIndex to the line you want highlighted remembering
that ItemIndex starts at line 0.
Set ItemIndex to -1 to select no line.
Stev