Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 21st, 2008, 12:39 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default Theme/skin win forms controls

My apologies for posting in what really is the generic .NET 2.0 framework forum, but frankly the Winforms forum doesn't seem to get much use or exposure.

Short question: How do I skin or theme windows forms controls?

I am starting a project to revamp an existing windows desktop application. We have decided to do a complete re-write (with liberal cut-'n-pasting) of the app from it's original .NET 1.1 version, into .NET 2.0 (not more than 2.0 for older platform support). I am looking into ways of expediting development by eliminating the overhead of manual styling of all the form's controls. I have googled a bit and found that control themes and skins are supported in 3.5, but of course that doesn't help me. 2.0 doesn't appear to have that functionality. I have found some samples (CodeProject and the like) that offer some solutions, but I wanted to get the p2p community's ideas and/or suggestions about the topic.

-Peter
compiledthoughts.com
__________________
-Peter
compiledthoughts.com
twitter/peterlanoie
Reply With Quote
  #2 (permalink)  
Old August 21st, 2008, 01:03 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi Peter..

I did something similar in 2.0. You can store in the config file colors, fonts and other things that let you personalize the controls. All you have to do is in everycontrol bound the corresponding property to the config file (and of course "field") and you are almost "skining" it. If you need more help I have the sample code of the form that let you personalize everything.

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #3 (permalink)  
Old August 21st, 2008, 04:05 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Gonzalo, thanks for the reply. So this solution requires that you set up data binding on each control, correct? Part of what I'm hoping to achieve is a solution that doesn't require a developer to touch every control in the form, essentially what skins let you do in ASP.NET: define a default style for each control type. Granted, by binding style properties to something I could abstract away the details of the styles to a central configuration, but I'm still left with the problem of having to bind each control. Perhaps I'll use the method of super classing my forms and controls so that standard styles can be applied to all child controls centrally. Of course, this still requires adjusting the class the forms and controls derive from. Same problem, just in a different place. Although, that would probably also eliminate the multiple bindings required for styles.

-Peter
compiledthoughts.com
Reply With Quote
  #4 (permalink)  
Old August 21st, 2008, 04:28 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

You can always build a control that is binding to the config file, and inherits always from it ;)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access other Forms Controls angelboy C# 2005 1 September 9th, 2007 10:35 AM
How to access web service in win forms saravanan.k .NET Web Services 2 May 5th, 2007 06:49 AM
Theme Selector wont pick up other theme Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 May 4th, 2007 08:44 AM
How i can change the theme(skin) of my form? sara_21 C# 2 April 8th, 2007 03:30 PM
Launch the .Net Win Forms from Excel spreadsheet Arunikhanna81 C# 0 January 15th, 2007 10:54 PM



All times are GMT -4. The time now is 03:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.