Solved

How to change a listBox 'BackColor' during runtime ?

Posted on 2006-07-11
3
266 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

12 Experts available now in Live!

Get 1:1 Help Now