GrapeCity MultiRow Windows Forms Documentation
CheckBoxCell Class
Members  Example 


Represents a Cell that displays a check box user interface (UI) to use in the GcMultiRow control.
Object Model
CheckBoxCell ClassMultiRowFlatButtonAppearance ClassGcMultiRow ClassCellStyle ClassCellNote ClassSection ClassCellStyle ClassMultiRowTouchToolBar ClassValidatorCollection ClassCellValidator Class
Syntax
<DefaultPropertyAttribute("Text")>
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.CheckBoxCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or  _
    ToolboxItemFilterType.Prevent Or  _
    ToolboxItemFilterType.Require)>
<ToolboxBitmapAttribute()>
<SRDescriptionAttribute("Enables the user to select or unselect the relative option.")>
Public Class CheckBoxCell 
   Inherits ButtonCellBase
   Implements IEditingCell 
Dim instance As CheckBoxCell
[DefaultProperty("Text")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.CheckBoxCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | 
    ToolboxItemFilterType.Prevent | 
    ToolboxItemFilterType.Require)]
[ToolboxBitmap()]
[SRDescription("Enables the user to select or unselect the relative option.")]
public class CheckBoxCell : ButtonCellBase, IEditingCell  
Remarks

The CheckBoxCell class is a special type of Cell used to display a check box control. The CheckBoxCell implements the IEditingCell interface, so it can be edited without an editing control. The user can edit the value of the cell by clicking or pressing the space key when the CheckBoxCell is the current cell.

Notes to Inheritors:

When you derive from CheckBoxCell and add new properties to the derived class, be sure to override the Clone method to copy the new properties during cloning operations. You should also call the base class's Clone method so that the properties of the base class are copied to the new cell.

Example
The following code example shows CheckBoxCell properties. You can set the ThreeState to true, and set each state's stored value through TrueValue, FalseValue, and IndeterminateValue. You can also change the Text and CheckAlign properties.
using System;
using System.Windows.Forms;
using System.Drawing;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class CheckBoxCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private Label label = new Label();

        public CheckBoxCellDemo()
        {
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);
            this.Load += new EventHandler(Form1_Load);
            this.gcMultiRow1.CellValueChanged += new 
EventHandler<CellEventArgs>(gcMultiRow1_CellValueChanged);

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 30;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "Click one CheckBoxCell to change the check state, then press ENTER key to commit 
value.";
            this.Controls.Add(label);
            this.Text = "CheckBoxCell Demo";
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CheckBoxCell checkBoxCell1 = new CheckBoxCell();
            checkBoxCell1.ThreeState = true;
            checkBoxCell1.TrueValue = "Yes";
            checkBoxCell1.FalseValue = "No";
            checkBoxCell1.IndeterminateValue = "Ignore";
            checkBoxCell1.Text = "State";
            checkBoxCell1.CheckAlign = ContentAlignment.MiddleRight;

            Template template1 = Template.CreateGridTemplate(new Cell[] { checkBoxCell1, checkBoxCell1.Clone() 
as Cell }, 160,
                AutoGenerateGridTemplateStyles.ColumnHeader | 
AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 3;
        }

        void gcMultiRow1_CellValueChanged(object sender, CellEventArgs e)
        {
            //When the value commits, the actual stored value is TrueValue, FalseValue, or IndeterminateValue.
            if (this.gcMultiRow1.CurrentCell.Value != null)
            {
                this.label.Text = "The current parsed value is " + this.gcMultiRow1.CurrentCell.Value.ToString();
            }
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new CheckBoxCellDemo());
        }
    }
}
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.MultiRow

Public Class CheckBoxCellDemo
    Inherits Form
    Friend WithEvents gcMultiRow1 As New GcMultiRow()
    Private label As New Label()

    Public Sub New()
        Me.gcMultiRow1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.gcMultiRow1)
        Me.label.Dock = DockStyle.Bottom
        Me.label.Height = 30
        Me.label.BackColor = SystemColors.Info
        Me.label.Text = "Click one CheckBoxCell to change the check state, then press ENTER key to commit 
value."
        Me.Controls.Add(label)
        Me.Text = "CheckBoxCell Demo"
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim checkBoxCell1 As New CheckBoxCell()
        checkBoxCell1.ThreeState = True
        checkBoxCell1.TrueValue = "Yes"
        checkBoxCell1.FalseValue = "No"
        checkBoxCell1.IndeterminateValue = "Ignore"
        checkBoxCell1.Text = "State"
        checkBoxCell1.CheckAlign = ContentAlignment.MiddleRight

        Dim template1 As Template = Template.CreateGridTemplate(New Cell() {checkBoxCell1, 
TryCast(checkBoxCell1.Clone(), Cell)})

        gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 3
    End Sub

    Private Sub gcMultiRow1_CellValueChanged(ByVal sender As Object, ByVal e As CellEventArgs) Handles 
gcMultiRow1.CellValueChanged
        'When the value commits, the actual stored value is TrueValue, FalseValue, or IndeterminateValue.
        If Me.gcMultiRow1.CurrentCell.Value <> Nothing Then
            Me.label.Text = "The current parsed value is " + Me.gcMultiRow1.CurrentCell.Value.ToString()
        End If
    End Sub

    <STAThreadAttribute()> _
    Public Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New CheckBoxCellDemo())
    End Sub
End Class
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.ButtonCellBase
               GrapeCity.Win.MultiRow.CheckBoxCell

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CheckBoxCell Members
GrapeCity.Win.MultiRow Namespace
Cell Class

 

 


Copyright © GrapeCity, inc. All rights reserved.