Is there an easy way to have a GroupBox auto resize its width depending on the length of the string in the Text property?
Say I fit the width by hand (in Design Mode) when the Text = "Text1" then, when the program is running, I update it to Text = "This is the new text!" I would like the width to auto expand instead of wrapping over to the next line.
Thanks!
You need to get the width of the string using the
Graphics.MeasureString MethodHere the simple example, hint, the width is depending of the size of the font not the font-size of your
GroupBoxproperty.I hope it will helps you.