Solved

Setting BackColor property

Posted on 2008-10-10
9
1,051 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
 
LVL 13

Assisted Solution

by:SameerJagdale
SameerJagdale earned 250 total points
ID: 22686224

this.toolStripSplitButton1.BackColor = Color.Green;
this.toolStrip1.RenderMode = ToolStripRenderMode.System ;
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now