473,382 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Visual Studio and Custom Control colors

I have code like this:

public class MyControl: Control
{
public MyControl()
{
this.BackColor = MyStandardBackColor;
}

public bool ShouldSerializeBackColor()
{
return BackColor != MyStandardBackColor;
}

public void ResetBackColor()
{
BackColor = MyStandardBackColor;
}
}

However, I have found that the VS2005 designer sets the control
backcolor to the Microsoft gray after MyControl is constructed. Is
there a way to prevent this from happening, so that my developers do
not have to go and manually reset the BackColor property of every
control?

Is there anyone at Microsoft who might be interested in this problem.
My bug reports are never acknowledged.

Jan 12 '06 #1
4 1578
Don't set it in the constructor.

"kevin cline" <ke*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have code like this:

public class MyControl: Control
{
public MyControl()
{
this.BackColor = MyStandardBackColor;
}

public bool ShouldSerializeBackColor()
{
return BackColor != MyStandardBackColor;
}

public void ResetBackColor()
{
BackColor = MyStandardBackColor;
}
}

However, I have found that the VS2005 designer sets the control
backcolor to the Microsoft gray after MyControl is constructed. Is
there a way to prevent this from happening, so that my developers do
not have to go and manually reset the BackColor property of every
control?

Is there anyone at Microsoft who might be interested in this problem.
My bug reports are never acknowledged.

Jan 12 '06 #2
Did you have an alternative in mind?

Jan 13 '06 #3
You need to override the BackColor Property and apply the DefaultValue
attribute. In the constructor set the this.BackColor = MyStandardBackColor.
Forget what I said about not setting the color in the constructor, my bad.
"kevin cline" <ke*********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Did you have an alternative in mind?

Jan 13 '06 #4

Rocky wrote:
You need to override the BackColor Property and apply the DefaultValue
attribute. In the constructor set the this.BackColor = MyStandardBackColor.
Forget what I said about not setting the color in the constructor, my bad.


There is no way to apply the DefaultValue attribute, because the
default back color is computed from a configuration file.

Jan 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Corrie Meyer | last post by:
Announcement: SwiftReports standard edition 1.0 for Visual Studio ..NET 2003 released by UniSwift. We are pleased to announce the first release of a fully-managed reporting tool for the...
2
by: SL33PY | last post by:
Hi, I'm currently working on an application written in Visual Basic .NET. I want to create some User Controls in order to add some specific functionality to the application. While reading on...
5
by: john | last post by:
I searched http://www.sellsbrothers.com. and could not find anything about this subject. How do I make C# User Controls Visible to Visual Basic 6.0 Applications? Thanks, John
2
by: Corrie Meyer | last post by:
Announcement: SwiftReports standard edition 1.0 for Visual Studio ..NET 2003 released by UniSwift. We are pleased to announce the first release of a fully-managed reporting tool for the...
0
by: Corrie Meyer | last post by:
Announcement: SwiftReports standard edition 1.0 for Visual Studio ..NET 2003 released by UniSwift. We are pleased to announce the first release of a fully-managed reporting tool for the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.