I have a grid of 5 columns and n rows. Row 0 is my header row. Each cell of the header row would contain text in German. As my cell width is fixed, trying to determine the row height so I can set that and display complete text in each cell.
Font i am using is Consolas
of size 10
For a given string I am calculating the size using TextRenderer.MeasureText
and getting the height and width of each string. Based on the max height, i set the header row height. This height value obtained is not always accurate as I observe some text that is cut off.
Is there a better approach to setting the height using the input string and the font and font size that is used? In addition can i get away from importing the Forms
class as I would like to move this into a library?