Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

listbox with icons , C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Thomas Adler - 28 Jun 2007 18:43 GMT
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
Ignacio Machin ( .NET/ C# MVP ) - 28 Jun 2007 19:26 GMT
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
Peter Duniho - 28 Jun 2007 19:36 GMT
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.