Solved

How to change a listBox 'BackColor' during runtime ?

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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