ComponentOne True DBGrid for WinForms
Cell Editing Techniques / In-Cell Buttons / Rendering Cells as Command Buttons
In This Topic
    Rendering Cells as Command Buttons
    In This Topic

    To render the current cell as a non-editable command button within a C1DisplayColumn object, set its ButtonText property to True in code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).ButtonText = True
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.Splits[0].DisplayColumns[0].ButtonText = true;
    

    When a cell within the column receives focus, it is rendered as a standard Windows command button using the cell text as the caption. The cell text is not centered automatically, but respects the column's horizontal and vertical alignment settings:


    If both the Button and ButtonText properties are True, the ButtonText property takes precedence.

    As with the default in-cell button, set the column's ButtonAlways property to True to force all of its cells to be displayed as command buttons. Only the current cell is drawn with a focus rectangle, however: