Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2004, 05:27 AM
Authorized User
 
Join Date: Apr 2004
Location: xiamen, fujian, China.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default A ListBox problem

Hello!

when I add a new item to my ListBox ,I want to choose a new color for
it(different color from other items).

Can I make it? or is there any method I can distingush some items from
other items except by selecting them.

Or to I have rewrite the ListBox ,to make it have this function.

waiting for help

Reply With Quote
  #2 (permalink)  
Old June 9th, 2004, 07:58 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It is my understanding that the <option> HTML element cannot have a color specified. The <select> element can, but that affects the entire select box not just particular elements. This is a limitation of HTML.
Reply With Quote
  #3 (permalink)  
Old June 9th, 2004, 08:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Is this what you are looking for?

http://www.c-sharpcorner.com/Code/20...llDropDown.asp

Brian
Reply With Quote
  #4 (permalink)  
Old June 10th, 2004, 01:55 AM
Authorized User
 
Join Date: Apr 2004
Location: xiamen, fujian, China.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks
but what about ListBox in window form,
can i make it in window application not web application?


Reply With Quote
  #5 (permalink)  
Old June 10th, 2004, 07:39 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Sorry for the confusion, you never specified what type of application you are building.
Reply With Quote
  #6 (permalink)  
Old June 12th, 2004, 03:26 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

if u need to have a list of colors to select why dont u use ColorDialog?! It was only a guess & suggestion.

Always:),
Hovik Melkomian.
Reply With Quote
  #7 (permalink)  
Old June 15th, 2004, 06:45 PM
Kep Kep is offline
Authorized User
 
Join Date: Aug 2003
Location: Melbourne, VIC, Australia.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could make the ListBox.DrawMode = DrawMode.OwnerDrawFixed. Then you need to write an event handler for the ListBox.DrawItem event.

You can use the args parameter of the event to draw the background and focus rectangle of the item. You should find it quite easy to change the font colour.

There's a good example in the help documentation.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox Problem Brendan Bartley Access 4 November 26th, 2007 01:34 PM
ListBox problem aliirfan84 ASP.NET 2.0 Professional 5 May 28th, 2007 08:39 AM
listbox problem faizee36 Access VBA 4 April 27th, 2006 09:58 AM
ListBox Problem spacy ASP.NET 1.x and 2.0 Application Design 2 October 18th, 2004 05:45 AM



All times are GMT -4. The time now is 09:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.