I have a listbox that gets text lines loaded in to it, if there are any text strings that are too long to fit in the listbox without being cut off I record the longest text length and I'm trying to increase the form size by the amount needed to make the list box wide enough to fit the text.
I've tried using this.Size, and this.Width, but neither seem to change anything, it just remembers whatever the form size is manually resized to the next time the app is reopened.
(I added debug text before and after the this.Size setting and I can see that the this.Size variable does actually get changed, but the change doesn't affect the window's size on screen.)
if (longesttextline > 32)
{
this.Size = new Size(newsize, this.Size.Height);
}
else
{
this.Size = new Size(this.MinimumSize.Width, this.Size.Height);
}