Solved

Setting BackColor property

Posted on 2008-10-10
9
1,062 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 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending receiving text messages in vb.net 15 48
Sort GridView by ID Descending 1 17
Vb.net threads keep increasing 2 35
VB.NET Textbox input validation 4 37
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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