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

x
?
Solved

Setting BackColor property

Posted on 2008-10-10
9
Medium Priority
?
1,086 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
  • 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 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Assisted Solution

by:SameerJagdale
SameerJagdale earned 1000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 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