I have a textbox control for which I want to fit twelve double spaced lines of text so that the textbox is optimally filled (as little whitespace at the end as possible). So far the best I have come up with is
Dim fh As Integer = txtCategories.Height \ 40
txtCategories.Font = New Font(txtCategories.Font.FontFamily, fh, FontStyle.Regular)
Unfortunately, while this works for the start size of the form, as I increase the size of the form the whitespace at the bottom increases (seems to be non-linear). Numbers higher than 40 cause text to be clipped at the form start size. Is there a method or property which will calculate an appropriate font size for a given textbox height?