Hi Pratima,
By default grid uses .Net graphics MeasureString method to calculate the size of the string. When the ResizeToFit method is called, Grid calls the CellModel.OnQueryPreferredClientSize which internally calls this method. You can use the code below to calculate the width of the characters inside any particular cell.
private int CalculateWidth(int row, int column)
{
GridStyleInfo style = gridDataBoundGrid.Model[row, column];
using (Graphics g = CreateGraphics())
{
string text = style.Text;
float width = g.MeasureString(text, style.GdipFont).Width;
int calculatedWidth = Convert.ToInt32(width);
return calculatedWidth;
}
}
Let us know if you need any further information.
Regards,
Rajagopal