By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Winform Style Sheets?

P: n/a
Hi all,

Is there a way to change the properties of certain controls on all forms
that a control exists on?

For instance, say I have 10 forms in a solution, and each has a datagrid. I
want to change the backgroundcolor of a datgrid and want this change to take
place on all the datagrids in the solution, is there a way to change it once,
and have it cascade to all the other datagrids?? Similar to a style sheet
with web pages...
Or do I have to change each one manually?

Thanks in advance,

--
Kevin
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
WinForms offers visual inheritance which will allow you to accomplish what
you're looking for. I typically create a base application form, let's call
it AppBaseForm, that other forms in my application derive from. This allows
me to control, in one location, a standard application icon, for example.

You can derive other forms from your base form as well- so if your
accounting department, for example, has a custom look and feel or graphic you
could inherit from AppBaseForm and create another base form called
AcctBaseForm that all accounting screens could inherit from.

..Net is an extensible framework. You can be more granular than the form
level and derive from the DataGrid control and extend it (ie, customize
colors) by creating a custom user control that extends the datagrid by
inheriting from it and customizing it. This allows you to add your custom
control onto one or many forms and control behaviour in a single location.

JP

"ksedran" wrote:
Hi all,

Is there a way to change the properties of certain controls on all forms
that a control exists on?

For instance, say I have 10 forms in a solution, and each has a datagrid. I
want to change the backgroundcolor of a datgrid and want this change to take
place on all the datagrids in the solution, is there a way to change it once,
and have it cascade to all the other datagrids?? Similar to a style sheet
with web pages...
Or do I have to change each one manually?

Thanks in advance,

--
Kevin

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.