I am using Visual C# with a WinForm project. I have a fixed-sized label to show some information. I want to be able to change the size of the font depending on the size (length) of the information (I'm trying to make sure all the information fits in the label).
The documentation I read says that I have to create a new font each time I want to change the font size with something life:
label1.Font = new Font(fontFamily, size);
I am concerned that since I will be changing the font size dozens of times, and therefore creating a new font many times, that I will be using up resources. Do I need to somehow dispose of the old font? How does one do that?
An alternative solution I am considering is two labels, one with a smaller font size, one with a larger font size, and programatically deciding which one should be visible and which one should be invisible. Is that a reasonable solution?
Thanks in advance for any advice.