|
-
May 27th, 2004, 11:25 AM
#1
Thread Starter
PowerPoster
Highlighting in a ListBox (RESOLVED)
Hi,
Please does anyone know how to highlight in colour one particular entry in a ListBox without affecting the others entries? I have got as far as realising that I have to make the ListBox Owner-Draw.
Then I have to put the entries into separate rectangles which have the appropriate back and fore colours, but I can't figure that out.
Last edited by taxes; May 27th, 2004 at 04:45 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 27th, 2004, 11:39 AM
#2
Do you have to use a listbox? If you use a listview, this is very easy:
VB Code:
Dim li As ListViewItem
Dim ch As ColumnHeader
'Set the view, so it looks like a listbox
ListView1.View = View.Details
'Create a new column, this can be done from the IDE using the column collection
ch = New ColumnHeader
ch.Text = "Column1"
ListView1.Columns.Add(ch)
'Add the items to the listview
li = ListView1.Items.Add("A")
li.ForeColor = Color.Red
li = ListView1.Items.Add("B")
li.ForeColor = Color.Blue
li = ListView1.Items.Add("C")
li.BackColor = Color.Black
li.ForeColor = Color.White
-
May 27th, 2004, 11:57 AM
#3
Thread Starter
PowerPoster
Many thanks for prompt reply.
Good idea.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|