reside font to for container in csharp

To resize font for a container in C#, you can use the following code:

main.cs
private void ResizeFont(Control control, float factor)
{
    control.Font = new Font(control.Font.FontFamily, control.Font.Size * factor, control.Font.Style);
}
161 chars
5 lines

You can then call this method for every control that you want to resize its font within a container. For example, if you have a Panel container:

main.cs
foreach (Control control in panel1.Controls)
{
    ResizeFont(control, 1.5f);  // increase font size by factor of 1.5
}
120 chars
5 lines

This will resize the font of all controls within the Panel by a factor of 1.5.

gistlibby LogSnag