Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to change a listBox 'BackColor' during runtime ?

Posted on 2006-07-11
3
Medium Priority
?
306 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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

876 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