Hi,
What is the best way (if there is any) to show pound signs instead of a number if a cell is not wide enough to display the whole formatted number? This is one of features in MS Excel. In order to do this, we need to be able to do at least the following tasks:
1) get the formatted number
2) get the font
3) get Graphics instance to call MeasureString on the formatted number with the font
4) get the width of the cell and it margins
Thanks,
Shaolin
Hi Shaolin,
Measuring the test yourself will be extremely difficult. But there might be an easier way. The grid and it's editors already keep track of whether or not the text fits inside the cell. They do this so the grid knows whether or not it's appropriate to show a tooltip.
So you could probably make use of that and then use a CreationFilter in order to change the Text of the cell to whatever you want without affecting the cell's value.
I decided to try to whip up a quick sample and it turned out to be surprisingly easy. My sample is attached here.
Hi Mike,
Thanks for your quick response and solution!
I tested your solution. Method IsTextFullyVisible is not always accurate.
Regards,