Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2007, 02:28 AM
Authorized User
 
Join Date: Sep 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default combo box

i want to have multiple forecolors for my combo box
i mean the items in combo box appears in different color

To be want to is to be able to.
Thanks , Best wishes

Shahab
__________________
To be want to is to be able to.
Thanks , Best wishes

Shahab
 
Old August 19th, 2007, 08:32 PM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Under what circumstances do you want to have different colors? I'm thinking JavaScript but I'm not quite sure what you are trying to do.

http://www.willasrari.com
 
Old August 21st, 2007, 08:34 AM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think your best solution will be a user defined control (UC) unless you can find one out there from another source. The problem is that the MS ComboBox (CB) stores and displays it's list as string objects. You don't have the ability to alter the display of the individual list items. I tried using a CB in a UC and discovered that the CB drawing overwrites the display area below it. You can't place a TextBox on top of the expanded CB dropdown because that area is out of the UC display space. I'm sure it could be done, but would be tricky. You might have better luck with a ListBox intstead of a ComboBox. But either way you need a custom control.

If I'm wrong, hopefully, someone will correct me.

What you don't know can hurt you!
 
Old August 21st, 2007, 09:43 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think David may be right. You could try redering it yourself by using the graphics object, but I am not sure if that graphics of the ComboBox will extend to include the List itself.

It would also be a bit of a hack...

A UDC may be the best way to go. It wouldnt suprise me if someone has already put together something that does this..

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
 
Old August 21st, 2007, 09:57 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just had a quick play with this, and it appears that the Graphics Object
will only ever cover the ComboBox itself, not the list that is produced.
Could be wrong here, only spent 2 mins on it...

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a text box from a combo box value dnf999 Access VBA 7 February 6th, 2012 02:24 PM
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





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