Solved

Setting BackColor property

Posted on 2008-10-10
9
1,069 Views
Last Modified: 2013-12-17
Hi, I have a ToolStripSplitButton and Ican see its backcolor property in design mode.  If I select it a BackColor, it doesn't change.  Ultimately, I want to change the BackColor in code, e.g.

uxToolStripObject.BackColor = Color.Blue;

Neither is working.  Me being a novice.

Please help.
0
Comment
Question by:sublimation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 22686070
Is it the individual button you're looking to change?  

In the properties of your ToolStrip change the Render to System.  Then you can change the colour of the button(s).

toolStripButton1.BackColor = Color.Blue;
0
 
LVL 4

Author Comment

by:sublimation
ID: 22686122
I do not see the Render proprty...?  Don't see it when I do a string search in entire project (including designers).  Don't see it on the ToolStrip, do you?
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 250 total points
ID: 22686165
Yes I do.  Go to your designer, click the toolstrip, select RenderMode (appologies for just saying Render), and change from ManagerRenderMode (or whatever the default is) to System.

Or in code:
toolStrip1.RenderMode = ToolStripRenderMode.System;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Assisted Solution

by:SameerJagdale
SameerJagdale earned 250 total points
ID: 22686224

this.toolStripSplitButton1.BackColor = Color.Green;
this.toolStrip1.RenderMode = ToolStripRenderMode.System ;
0
 
LVL 4

Author Comment

by:sublimation
ID: 22687587
Hi, Guys.

Have tried what you have reccomended, it looks prety obvious what you are saying, for some reson, the color still doest show, even in design mode (did it in code too).

StatusStrip.RenderMode = ToolStripRenderMode.System; //System.Windows.Form.ToolStrip
ToolStripButton.BackColor = Color.Green;   //System.Windows.Form.ToolstripSplitButton

Can anybody test this?  Thanks!!

Have increased the points (altough I know you help from personal kindness and not points)
0
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 22687628
Are you calling that on your form load?  If its in the button click event you will need to click the button before the code is activated.  

And you want to do it for the actual buttons, not the ToolStripButton/StatusStrip classes.  
0
 
LVL 4

Author Comment

by:sublimation
ID: 22688279
Hi, I am doing it for the actual buttons, I put the class name there just so you can see the exact objects I am using.

The procedure fires off after the form is loaded by the user clicking on a 'refresh' button.

Thanks.
0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 22693540
sublimation,
what you are doing is setting the properties to a class itself, this will not work. You need to set the properties of the instance of the class ( i mean the actual object).
something like this:

StatusStrip.RenderMode = System.Windows.Forms.ToolStrip;  // StatusStrip is a static class.
this.toolStrip1.RenderMode = ToolStripRenderMode.System; // actual object.
//ToolStripButton is a class..
ToolStripButton.BackColor = Color.Green; //System.Windows.Form.ToolstripSplitButton
this.toolStripSplitButton1.BackColor = Color.Green;  //actual object..
0
 
LVL 4

Author Comment

by:sublimation
ID: 22709792
Yes, I understand that I need to assign value on property of object, I just called the object the name of the class so you know exactly what control I was using.

I have decided to change forecolour instead (that works), so I will close this call.  I think there must have been something going on since I had many controls (third party, Devexpess e.t.c) and it could be a bug.

The code you guys have shown me is correct and what I was trying tto do, so I will share out the points to those who gave comprehensive replys.

Many thanks.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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