Adjusting the label size is pointless. The adequate method of sizing for a label is
myLabel.AutoSize = true
;
https://msdn.microsoft.com/en-us/library/system.windows.forms.label.autosize(v=vs.110).aspx[
^].
It does not solve the problem itself. The label can be fully visible or not due to the size of the parent controls. Such problems are solved by UI design, not by adjusting anything. First of all, you should never use any manual positioning or sizes. All controls should be hierarchically docked into each other (
DockType
other then
None
), with the proper use of the
Padding
properly. Then you can achieve automatic resizing of inner content of all controls when you resize the window or one of panels.
Also, you should always gives the user the possibility to resize the form, as well as some parts of it, through the
Splitter
control. You can never predict the size required for a control in some long-word languages, such as German or Hungarian. However, you can try to calculate required size and adjust the form size or the size of some panel automatically, using this methods:
https://msdn.microsoft.com/en-us/library/System.Drawing.Graphics.MeasureString(v=vs.110).aspx[
^].
The problem is: those
System.Drawing.Graphics.MeasureString
methods are not precise, so the actual string width is often a bit greater than predicted. This is a big complication which appears in non-monospace fonts due to such delicate effects as
hinting The problem was extensively discussed on Web, but I still don't know the perfect solution. Perhaps you need just to add some extra space.
For some solutions and the ideas, see also this CodeProject article:
Bypass Graphics.MeasureString limitations[
^].
—SA