Click here to Skip to main content
15,438,113 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI friends,,,,

How to change the color and size of all fonts in a single click(Button) in Windows Application.....
Shubh Agrahari 11-Mar-13 6:12am    
can you clarify that actually what you want to do...
PRAKASH_N 11-Mar-13 6:21am    
I want to change a fonts of the labels or header text of my window apps to be BOLD on a single click......

I think you have to design your application for this feature from the beginning on. You can create your own "styling" layer to apply the fonts, or use some kind of generic "spider" to find all fonts to change. I know a framework where a "FontClass" (somthing like HeaderFont, LabelFont etc.) property was added to all controls. These "FontClasses" are just "wrappers" for real fonts. In the end these "FontClasses" can be changed during runtime/design-time and so they can change all fonts where the changed "FontClass", instead of a directly set Font, is used. Maybe you want to implement something similar?
Share this answer
private void button1_Click(object sender, EventArgs e)
            foreach (Control c in this.Controls)
                c.Font = new Font(c.Font,c.Font.Style|FontStyle.Bold);


Share this answer
Sm.Abdullah 12-Mar-13 1:38am     CRLF
what if a control which do not have a Property of Font.. ? It can be a custom control too.
Aarti Meswania 12-Mar-13 1:40am     CRLF
then modify this function if it have child controls then it will search that child control and set font bold use recursion concept :)
Aarti Meswania 12-Mar-13 1:41am    
5+ ! good answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900