0

I'm trying to develop a method that resizes the font of a label on the form by 0.25f each time the size changes by 1. I'm thinking create a ratio or do some math about the font size based on the form size like i do with other controls.

Edited by lxXTaCoXxl: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by CeilingSpy
0

I am not sure if you can resize the size of a label at run-time, so instead I made it change the text of a label (making it a bigger or smaller number):

int height;
        int width;

        private void Form1_Load(object sender, EventArgs e)
        {
            height = 362;
            width = 634;
        }

        private void Form1_Resize(object sender, EventArgs e)
        {            
            if (this.Size.Height > height || this.Size.Width > width)
            {
                height = this.Size.Height;
                width = this.Size.Width;
                label1.Text = (Int32.Parse(label1.Text) + 1).ToString();
            }
            else if (this.Size.Height < height || this.Size.Width < width)
            {
                height = this.Size.Height;
                width = this.Size.Width;
                label1.Text = (Int32.Parse(label1.Text) - 1).ToString();
            }
        }

Hope this helps!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.