Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Cell Types / Working with Editable Cell Types / Setting a GcCharMask Cell
In This Topic
    Setting a GcCharMask Cell
    In This Topic

    The GcCharMask cell uses character boxes for the mask. The user can customize the appearance of the boxes and the input value.

    GcCharMask Cell

    The following image displays the characters you can use for the mask (FormatString property).

    List displaying characters you can use for the mask

    You can specify a built-in collection of character boxes with the CharBoxInfoCollection class or you can customize the number and layout of the boxes with the LiteralBoxInfo, InputBoxInfo, and SeparatorBoxInfo classes. Use the AddRange method to add the built-in boxes or the custom boxes in the preferred order.

    For a complete list of properties and methods for the GcCharMask cell, refer to the GcCharMaskCellType class.

    Using Code

    1. Define the GcCharMask cell by creating an instance of the GcCharMaskCellType class.
    2. Set properties for the class.
    3. Assign the cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style to the GcCharMaskCellType object.

    Example

    This example creates a GcCharMask cell.

    C#
    Copy Code
    GrapeCity.Win.Spread.InputMan.CellType.GcCharMaskCellType gc = new
    GrapeCity.Win.Spread.InputMan.CellType.GcCharMaskCellType();
    gc.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.CtrlArrows;
    gc.AcceptsCrLf = GrapeCity.Win.Spread.InputMan.CellType.CrLfMode.Filter;
    gc.AllowSpace = GrapeCity.Win.Spread.InputMan.CellType.AllowSpace.Wide;
                    
    gc.CharBoxes.AddRange(GrapeCity.Win.Spread.InputMan.CellType.CharBoxInfoCollection.Number1);
    gc.CharBoxSpacing = 2;
    gc.ClipContent = GrapeCity.Win.Spread.InputMan.CellType.ClipContent.ExcludeLiterals;
                    
    gc.ExitOnLastChar = true;
    gc.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.EditorBaseFocusCursorPosition.FirstInputPosition;
    gc.FormatString = "a";
    gc.PaintByControl = true;
    gc.RecommendedValue = "aaaaaaaaaa";
    gc.ShowRecommendedValue = true;
    gc.UseSpreadDropDownButtonRender = true;
    fpSpread1.ActiveSheet.Cells[0, 0].CellType = gc;
    fpSpread1.ActiveSheet.Columns[0].Width = 200;
    fpSpread1.ActiveSheet.Rows[0].Height = 40;
            
    
    VB
    Copy Code
    Dim GC As New GrapeCity.Win.Spread.InputMan.CellType.GcCharMaskCellType()
    GC.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.CtrlArrows
    GC.AcceptsCrLf = GrapeCity.Win.Spread.InputMan.CellType.CrLfMode.Filter
    GC.AllowSpace = GrapeCity.Win.Spread.InputMan.CellType.AllowSpace.Wide
                    
    GC.CharBoxes.AddRange(GrapeCity.Win.Spread.InputMan.CellType.CharBoxInfoCollection.Number1)
    GC.CharBoxSpacing = 2
    GC.ClipContent = GrapeCity.Win.Spread.InputMan.CellType.ClipContent.ExcludeLiterals
                    
    GC.ExitOnLastChar = True
    GC.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.EditorBaseFocusCursorPosition.FirstInputPosition
    GC.FormatString = "a"
    GC.PaintByControl = True
    GC.RecommendedValue = "aaaaaaaaaa"
    GC.ShowRecommendedValue = True
    GC.UseSpreadDropDownButtonRender = True
    fpSpread1.ActiveSheet.Cells(0, 0).CellType = GC
    fpSpread1.ActiveSheet.Columns(0).Width = 200
    fpSpread1.ActiveSheet.Rows(0).Height = 40
    

    Using the Spread Designer

    1. Select the cell or cells in the work area.
    2. In the property list, in the Misc category, select CellType. From the drop-down list, choose the GcCharMask cell type. Now expand the CellType property and various properties are available that are specific to this cell type. Select and set those properties as needed.

      Or right-click on the cell or cells and select Cell Type. From the list, select GcCharMask. In the CellType editor, set the properties you need. Click Apply.

    3. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.