Spread Windows Forms 11.0 Product Documentation
ButtonDrawMode Property (FpSpread)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : ButtonDrawMode Property
Gets or sets whether to display buttons in button and combo box cells in the component.
Syntax
'Declaration
 
Public Property ButtonDrawMode As ButtonDrawModes
'Usage
 
Dim instance As FpSpread
Dim value As ButtonDrawModes
 
instance.ButtonDrawMode = value
 
value = instance.ButtonDrawMode
public ButtonDrawModes ButtonDrawMode {get; set;}

Property Value

ButtonDrawModes setting that specifies how to display buttons in cells
Remarks

Use this property to limit where buttons are displayed in the spreadsheet. You can combine values using the OR logical operator. You can also perform the equivalent of OR-ing by adding the numeric values 1 (current cell), 2 (current column), 4 (current row), 8 (always button), and 16 (always combo box) for the combination you want.

When the OperationMode property is set to Row Mode, RowMode uses the ButtonDrawMode property. The active row is always painted with a selection bar. The buttons are painted or not painted based on the setting of the ButtonDrawMode property. (Note, in Spread COM, RowMode ignored the ButtonDrawMode property. Before editing the active row, the active row was painted with a selection bar but without buttons. After editing the active row, the active row was painted with buttons but without a selection bar. In Spread for Windows Forms, there is no distinction between before and after editing.)

Create a button or combo box cell using the ButtonCellType or ComboBoxCellType. class For an overview of these graphical cell types, refer to Working with Graphical Cell Types.

Example
This example specifies whether to display a button in a combo box cell.
FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread();
FarPoint.Win.Spread.SheetView shv = new FarPoint.Win.Spread.SheetView();
DialogResult dlg;
fpSpread1.Location = new Point(10, 10);
fpSpread1.Height = 200;
fpSpread1.Width = 400;
Controls.Add(fpSpread1);
fpSpread1.Sheets.Add(shv);
fpSpread1.ActiveSheet.Cells[0, 0].CellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
fpSpread1.ActiveSheet.Cells[1, 0].CellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
fpSpread1.ActiveSheet.Cells[1, 2].CellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
dlg = MessageBox.Show("Do you want to hide the button for the combo box in the third column??", "ButtonDrawMode", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
     fpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentColumn;
}
Dim fpSpread1 As New FarPoint.Win.Spread.FpSpread()
Dim shv As New FarPoint.Win.Spread.SheetView()
Dim dlg As DialogResult
fpSpread1.Location = New Point(10, 10)
fpSpread1.Height = 200
fpSpread1.Width = 400
Controls.Add(fpSpread1)
fpSpread1.Sheets.Add(shv)
fpSpread1.ActiveSheet.Cells(0, 0).CellType = New FarPoint.Win.Spread.CellType.ComboBoxCellType()
fpSpread1.ActiveSheet.Cells(1, 0).CellType = New FarPoint.Win.Spread.CellType.ComboBoxCellType()
fpSpread1.ActiveSheet.Cells(1, 2).CellType = New FarPoint.Win.Spread.CellType.ComboBoxCellType()
dlg = MessageBox.Show("Do you want to hide the button for the combo box in the third column??", "ButtonDrawMode", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
     fpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentColumn
End If
See Also

Reference

FpSpread Class
FpSpread Members
ButtonDrawModes Enum
ButtonCellType Class
ComboBoxCellType Class

User-Task Documentation

Allowing Button Display