Get Font width in windows form
-
I am working on a printing a report and need to know how to calculate the font width by device. Height is easy (font.GetHeight(graphics);), but there is not a similar setting for width. There used to be an API call (I think it was something like GetTextMatrix) that I used to determine the average width (letters like M and W were wider than letters like I and l). Is there something I can do to check before I start printing? or is there a way that if I ireate through the arrays I can tell what the maximum width are for each column before I start the print page routine. Thanks,
Leo T. Smith Program/Analyst Supervisor
-
I am working on a printing a report and need to know how to calculate the font width by device. Height is easy (font.GetHeight(graphics);), but there is not a similar setting for width. There used to be an API call (I think it was something like GetTextMatrix) that I used to determine the average width (letters like M and W were wider than letters like I and l). Is there something I can do to check before I start printing? or is there a way that if I ireate through the arrays I can tell what the maximum width are for each column before I start the print page routine. Thanks,
Leo T. Smith Program/Analyst Supervisor
Use the graphics context for the device and call MeasureString.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway -
Use the graphics context for the device and call MeasureString.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway