Using the TextWidth function in a datagrid
I'm using the TextWidth function to size a column in datagrid. The intention is to resize the column such that it will be just the right length to contain the value (is it called autosizing?).
It doesn't seem to work though. Each time it runs, I resize it to fit the string D:\Source\ABS\SQL\*.sql
, but it chops off half the q
and all of the l
. How can I get around this?
I did a search and came up with the API function GetTextExtentPoint32, which looks very complicated for such a small thing, so I can't help thinking that there must be an easier way.
Son, he said, grab your things, I've come to take you home [Solsbury Hill, Peter Gabriel]