?
Solved

Button designer, strange behaviour

Posted on 2007-08-02
6
Medium Priority
?
350 Views
Last Modified: 2013-11-17
I create a Button from the compact framework (well..an extension) and it creates following line:
this.iconButtonPrint.UseVisualStyleBackColor = true;
in the xxx.Designer.cs file

UseVisualStyleBackColor is not part of the COmpat framwork, or so it sais, and does not show anything in the designer. How to do not make it creaet it?
0
Comment
Question by:dkloeck
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:gbzhhu
ID: 19616649
How did you create/extend the button?

I haer that the CF project template has errors.  Can you not comment the line?
0
 
LVL 10

Author Comment

by:dkloeck
ID: 19617053
There is a class IconButton which is child of button (in a CF project)
Then there is another IconButtonPc which is child of IconButton (not in CF)

and the last is what I use, but since it derives from a CF project button, shouldn't it have all the properties from the CF, and not the ones for PC?
0
 
LVL 12

Expert Comment

by:gbzhhu
ID: 19617363
The way I see it IconButtonPc relies on the implementation of IconButton (which CF control).  The trouble is that you are attempting to create a desktop project and Visual studio will put UseVisualStyleBackColor  since the project is desktop not CF.  When you compile though the basec lass of button (CF) will be run and code in there doesn't have UseVisualStyleBackColor .

That is what I believe is happening?  May I ask why you are mixing CF and desktop development?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 10

Author Comment

by:dkloeck
ID: 19619111
Yeah, that's the problem. Do you know how I could solve it?

I'm using CF and desktop bcos its an application for PDA and PC.

Why is it that VS adds Desktop properties if I am extending a CF type, even if it is in a Desktop project?
0
 
LVL 12

Accepted Solution

by:
gbzhhu earned 2000 total points
ID: 19619517
>>Why is it that VS adds Desktop properties if I am extending a CF type, even if it is in a Desktop project?
the button you are inheriting from IconButtonPc is built with the full .NET framework but it itself inherited from CF button built with .NET CF.  I don't think VS is clever enough to trace deep inhertance level for different types of projects(desktop and device) mixed.  It is probably looking at the project being desktop and throws you the UseVisualStyleBackColor.  This is my guess but I maybe wrong.

I don't really know a solution to this other than commenting out the VS generated code.
0
 
LVL 10

Author Comment

by:dkloeck
ID: 19621422
The bad thing is that after rebuilding it, the line apears again :(
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

621 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