How to display placeholder characters when cell content exceeds cell width

9 Dec 20193 minutes to read

If the content of a grid cell exceeds the cell width, then characters can be displayed to act as placeholders instead of actual letters or numbers, indicating that the cell contains more content than can be shown within the cell. By default, the number sign (#) is used as the placeholder character, but you can specify custom characters.You can enable the following types of cell content to be converted to placeholder characters when content exceeds cell size:

  • Alphabetic
  • Numeric
  • Both alphabetic and numeric
  • None

NOTE

When set to None, the original content will be displayed.

Converting alphabetic content

Use the following code to specify that only alphabetic content will be converted to placeholder characters when content exceeds a cell.

this.gridcontrol1[1,1].AutoFit=AutoFitOptions.Alphabet;
Me.gridcontrol1(1,1).AutoFit=AutoFitOptions.Alphabet

Converting numeric content

Use the following code to specify that only numeric content will be converted to placeholder characters when content exceeds a cell.

this.gridcontrol1[1,1].AutoFit=AutoFitOptions.Numeric
Me.gridcontrol1(1,1).AutoFit=AutoFitOptions.Numeric

Converting alphabetic and numeric contents

The following code specifies that both alphabetic and numeric content will be converted to placeholder characters. To do so, set AutoFitOptions to Both.

this.gridcontrol1[1,1].AutoFit=AutoFitOptions.Both
Me.gridcontrol1(1,1).AutoFit=AutoFitOptions.Both

Not converting content

Use the following code to display original cell content without converting anything to placeholder characters. This is performed by setting AutoFitOptions to None.

this.gridcontrol1[1,1].AutoFit=AutoFitOptions.None
Me.gridcontrol1(1,1).AutoFit=AutoFitOptions.None

NOTE

By default, AutoFitOptions is set to None.

Setting custom characters

Characters other than the number sign (#), the default, can be used to replace alphanumeric content that exceeds the size of a cell.To do so, set AutoFitChar to the desired character. For example, in the code samples below, the placeholder character has been changed to the at (@) character.

this.gridcontrol1[1,1]. AutoFitChar=’@’
Me.gridcontrol1[1,1]. AutoFitChar=’@’

The following sample demonstrates how to use placeholder characters for content exceeding a cell’s dimensions.

<Installed location of Essential Studio>\<Essential Studio Version Number>\Windows\Grid.Windows\Samples\2.0\Grid Layout\Resize To Fit Demo