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.
> Hello,
>
[quoted text clipped - 20 lines]
>
> Best regards Thomas
> 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
[quoted text clipped - 7 lines]
> 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
Thomas Adler - 29 Jun 2007 08:22 GMT
Hello together,
thanks for the response.
> > Icon1 --- Item1 ----comment01
> > Icon1 --- Item2 ----comment01
[quoted text clipped - 21 lines]
> 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
Ignacio Machin ( .NET/ C# MVP ) - 29 Jun 2007 15:59 GMT
Hi,
> Hello together,
>
[quoted text clipped - 29 lines]
> 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/quickstart/howto/doc/WinForms/WinFormsOwnerDrawList
Box.aspx
http://www.opennetcf.org/permalink2.aspx?guid=d88b1a1a-a866-4247-a0c8-94ab3c124f63
I was targeting the compact framework so I used more the second link.