Wrox Programmer Forums
|
.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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 21st, 2008, 12:39 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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
 
Old August 21st, 2008, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
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
================================================== =========
 
Old August 21st, 2008, 04:05 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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
 
Old August 21st, 2008, 04:28 PM
Friend of Wrox
 
Join Date: Jun 2003
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
================================================== =========





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





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