Solved

Setting BackColor property

Posted on 2008-10-10
9
1,065 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
Independent Software Vendors: 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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 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