Solved

How to change a listBox 'BackColor' during runtime ?

Posted on 2006-07-11
3
273 Views
Last Modified: 2010-04-24
Greetings:

I have a .Net Form Application and need to toggle a listBox background color from red to green during run-time.  I realize the listBox property has this setting in the designer mode but that doesn't do me any good.

I'm guessing the syntax goes like this:

listBox1->BackColor =  some hex value

If there is a list of all available colors that would be even better, otherwise red and green are fine.

I did some reading on-line and saw something like the stuff below ... is all that necessary ?

public:
virtual property Color BackColor {
    Color get () override;
    void set (Color value) override;
}
0
Comment
Question by:John500
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 250 total points
ID: 17084864
You can set all these colors to the listbox
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingcolorclasstopic.asp

listBox1->BackColor = Color::Red;
0
 
LVL 15

Expert Comment

by:lakshman_ce
ID: 17084880
0
 

Author Comment

by:John500
ID: 17086248
Thanks again !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now