By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

listbox with icons , C#

P: n/a
Hello,

I want to create a listbox with icons.

Icon1 --- Item1 ----comment01
Icon1 --- Item2 ----comment01
Icon1 --- Item3 ----comment01
Icon2 --- Item4 ----comment01
Icon1 --- Item5 ----comment01
Icon2 --- Item6 ----comment06
......
Icon2 --- ItemN ----comment0N

The listbox have 10 entries. After then, the scrollbar should be appears.
If Entries 500 I want to delete the oldest item.

The icon is depend from the state. I need more than 2 icons.

Addtional I need a log file for all items entries.
Every day a new log file.

How can i make that?

Best regards Thomas
Jun 28 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

You cannot do this with the stock Listbox, you have two options:
1- Implement your own control
2- Use a third party tool. I use Infragistics and they have a combobox
control that have this feature you want.

"Thomas Adler" <th***********@nospam.arcornews.dewrote in message
news:46***********************@newsspool4.arcor-online.net...
Hello,

I want to create a listbox with icons.

Icon1 --- Item1 ----comment01
Icon1 --- Item2 ----comment01
Icon1 --- Item3 ----comment01
Icon2 --- Item4 ----comment01
Icon1 --- Item5 ----comment01
Icon2 --- Item6 ----comment06
.....
Icon2 --- ItemN ----comment0N

The listbox have 10 entries. After then, the scrollbar should be appears.
If Entries 500 I want to delete the oldest item.

The icon is depend from the state. I need more than 2 icons.

Addtional I need a log file for all items entries.
Every day a new log file.

How can i make that?

Best regards Thomas

Jun 28 '07 #2

P: n/a
On Thu, 28 Jun 2007 10:43:26 -0700, Thomas Adler
<th***********@nospam.arcornews.dewrote:
Hello,
Hi.
I want to create a listbox with icons.
You can override the DrawItem and related events to draw the icon as you
like. If you can use a ListView instance instead, then that offers the
various ImageList properties (LargeImageList, SmallImageList,
StateImageList) that you can use to easily assign specific icons to list
items.
Icon1 --- Item1 ----comment01
Icon1 --- Item2 ----comment01
Icon1 --- Item3 ----comment01
Icon2 --- Item4 ----comment01
Icon1 --- Item5 ----comment01
Icon2 --- Item6 ----comment06
.....
Icon2 --- ItemN ----comment0N

The listbox have 10 entries. After then, the scrollbar should be appears.
If Entries 500 I want to delete the oldest item.
The scrollbar you can just enable. The removal of the oldest item you
will have to do yourself.
The icon is depend from the state. I need more than 2 icons.
See above.
Addtional I need a log file for all items entries.
Every day a new log file.
This is separate from the ListBox or ListView class. You'll have to write
some other code to write out the log file entries as they are added to the
ListBox or ListView.

Pete
Jun 28 '07 #3

P: n/a
Hello together,

thanks for the response.
Icon1 --- Item1 ----comment01
Icon1 --- Item2 ----comment01
Icon1 --- Item3 ----comment01
Icon2 --- Item4 ----comment01
Icon1 --- Item5 ----comment01
Icon2 --- Item6 ----comment06
.....
Icon2 --- ItemN ----comment0N
The listbox have 10 entries. After then, the scrollbar should be appears.
If Entries 500 I want to delete the oldest item.

The scrollbar you can just enable. The removal of the oldest item you
will have to do yourself.
The icon is depend from the state. I need more than 2 icons.

See above.
Addtional I need a log file for all items entries.
Every day a new log file.

This is separate from the ListBox or ListView class. You'll have to write
some other code to write out the log file entries as they are added to the
ListBox or ListView.
Have you a link or code example?
Maybe first, without icons. It is easier.

Thanks.

Regards Thomas

Jun 29 '07 #4

P: n/a
Hi,
"Thomas Adler" <th***********@arcor.dewrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
Hello together,

thanks for the response.
Icon1 --- Item1 ----comment01
Icon1 --- Item2 ----comment01
Icon1 --- Item3 ----comment01
Icon2 --- Item4 ----comment01
Icon1 --- Item5 ----comment01
Icon2 --- Item6 ----comment06
.....
Icon2 --- ItemN ----comment0N
The listbox have 10 entries. After then, the scrollbar should be
appears.
If Entries 500 I want to delete the oldest item.

The scrollbar you can just enable. The removal of the oldest item you
will have to do yourself.
The icon is depend from the state. I need more than 2 icons.

See above.
Addtional I need a log file for all items entries.
Every day a new log file.

This is separate from the ListBox or ListView class. You'll have to
write
some other code to write out the log file entries as they are added to
the
ListBox or ListView.
Have you a link or code example?
Maybe first, without icons. It is easier.

I was looking into creating a owner drawing control (a listbox) a time ago.
These links helped me a lot
http://samples.gotdotnet.com/quickst...awListBox.aspx
http://www.opennetcf.org/permalink2....8-94ab3c124f63

I was targeting the compact framework so I used more the second link.
Jun 29 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.