GrapeCity MultiRow Windows Forms Documentation
Adjust Character Size with Placeholders

The designer provides a DesignTimeValue property that you can use to set the characters that are displayed only at design time (Designtime Placeholder). By using this property at design time, you can display the value for estimating the cell size, and hide this value at run time, without the need for code. For example, using a fixed width font and a fixed number of characters, you can estimate the size of the string using dummy values like "999-9999" or "XXXXXXX".

DesignTimeValue is a special property that can only be used at design time and cannot be used at runtime. Use the Cell.Value property to display the same value at design time as well as runtime.

Design Time Placeholders

Tutorial

Since the DesignTimeValue property is mainly used to estimate the width of the string, it is recommended to use it with fixed width fonts.

The following steps explain how to specify the fixed width font and dummy string.

  1. Open the designer.
  2. Select TextBoxCell from the toolbox and drag it to the Row section.
  3. Using the Properties window, set the Font property of textBoxCell1 to Arial, 11 points.
  4. Set the MaxLength property of textBoxCell1 to 10 through the Properties window.
  5. Set the DesignTimeValue property of textBoxCell1 to XXXXXXXXXX in the Properties window.
  6. Change the width of textBoxCell1 depending on the string that is displayed in it.
  7. Click the Runtime tab of the Document window, and check whether exactly 10 characters can be entered in the display area of textBoxCell1.

Data Type of DesignTimeValue Property

The specification of the DesignTimeValue property is same as the Value property of that cell. For example, in the date type cell (DateTimePickerCell), since the Cell.Value property has a Date type value, the type of the DesignTimeValue property is also Date type.

Storage Location of DesignTimeValue Property

The DesignTimeValue property is not a hidden property of the cell, but is design information. The value of the DesignTimeValue property is stored in the Template.resx file, and is not output to Template.Designer.vb (or Template.Designer.cs).

Related topics are Locking Cells in the Designer and Create Template from Table.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options