GrapeCity.Win.MultiRow Namespace : RadioGroupCell Class |
<SRDescriptionAttribute("Enables the user to select a single option from a group of choices.")> <ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or _ ToolboxItemFilterType.Prevent Or _ ToolboxItemFilterType.Require)> <DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.RadioGroupCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")> <ToolboxBitmapAttribute()> <DefaultPropertyAttribute("Items")> Public Class RadioGroupCell Inherits Cell Implements IEditingCell
Dim instance As RadioGroupCell
[SRDescription("Enables the user to select a single option from a group of choices.")] [ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | ToolboxItemFilterType.Prevent | ToolboxItemFilterType.Require)] [Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.RadioGroupCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")] [ToolboxBitmap()] [DefaultProperty("Items")] public class RadioGroupCell : Cell, IEditingCell
The RadioGroupCell class is a special type of Cell used to display a set of radio buttons. The RadioGroupCell implements the IEditingCell interface, so it can be edited without an editing control. The user can edit the cell value using a simple click or by pressing the left, right, up, or down key when the RadioGroupCell is the current cell and is in edit mode.
When a user selects a radio button in RadioGroupCell, the other radio buttons in the same RadioGroupCell are not selected. Define a radio group when you want to present a set of choices from which the user can choose one and only one.
Notes to Inheritors:
When you derive from RadioGroupCell 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.
using System; using System.Windows.Forms; using System.Drawing; namespace GrapeCity.Win.MultiRow.SampleCode { public class RadioGroupCellDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private Label label = new Label(); public RadioGroupCellDemo() { this.Text = "RadioGroupCell Demo"; this.gcMultiRow1.Dock = DockStyle.Fill; this.label.Height = 30; this.label.Dock = DockStyle.Bottom; this.label.BackColor = SystemColors.Info; this.label.Text = "Click one cell to show the clicked item."; this.Controls.Add(this.gcMultiRow1); this.Controls.Add(this.label); this.Load += new EventHandler(Form1_Load); this.gcMultiRow1.CellEditedFormattedValueChanged += new EventHandler<CellEditedFormattedValueChangedEventArgs>(gcMultiRow1_CellEditedFormattedValueChanged); this.Size = new Size(400, 400); } private void Form1_Load(object sender, EventArgs e) { RadioGroupCell radioGroupCell1 = new RadioGroupCell(); radioGroupCell1.Size = new Size(150, 60); radioGroupCell1.Items.AddRange(new string[] { "1", "2", "3", "4", "5", "6" }); radioGroupCell1.CheckAlign = ContentAlignment.MiddleLeft; //6 radio cells in 3 columns. radioGroupCell1.ColumnCount = 3; //The radio button ranges from left to right. radioGroupCell1.FlowDirection = Orientation.Horizontal; //Between every 2 columns, 20 pixels exist. radioGroupCell1.HorizontalSpace = 20; radioGroupCell1.FlatStyle = FlatStyle.Popup; RadioGroupCell radioGroupCell2 = new RadioGroupCell(); radioGroupCell2.Size = new Size(150, 60); radioGroupCell2.Items.AddRange(new string[] { "11111", "22222", "33333", "44444", "55555", "66666" }); radioGroupCell2.CheckAlign = ContentAlignment.MiddleLeft; //6 radio cells in 3 columns. radioGroupCell2.ColumnCount = 3; //The radio button ranges from top to bottom. radioGroupCell2.FlowDirection = Orientation.Vertical; //Between every 2 lines, 20 pixels exist. radioGroupCell2.VerticalSpace = 20; // radioGroupCell2.Ellipsis = MultiRowEllipsisMode.EllipsisEnd; radioGroupCell2.EllipsisString = "..."; Template template1 = Template.CreateGridTemplate(new Cell[] { radioGroupCell1, radioGroupCell2 }); gcMultiRow1.Template = template1; gcMultiRow1.RowCount = 3; }
Imports System Imports System.Windows.Forms Imports System.Drawing Imports GrapeCity.Win.MultiRow Public Class RadioGroupCellDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private label As New Label() Public Sub New() Me.Text = "RadioGroupCell Demo" Me.gcMultiRow1.Dock = DockStyle.Fill Me.label.Height = 30 Me.label.Dock = DockStyle.Bottom Me.label.BackColor = SystemColors.Info Me.label.Text = "Click one cell to show the clicked item." Me.Controls.Add(Me.gcMultiRow1) Me.Controls.Add(Me.label) Me.Size = New Size(400, 400) End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim radioGroupCell1 As New RadioGroupCell() radioGroupCell1.Size = New Size(150, 60) radioGroupCell1.Items.AddRange(New String() {"1", "2", "3", "4", "5", "6"}) radioGroupCell1.CheckAlign = ContentAlignment.MiddleLeft '6 radio cells in 3 columns. radioGroupCell1.ColumnCount = 3 'The radio button will range from left to right. radioGroupCell1.FlowDirection = Orientation.Horizontal 'Between every 2 columns, 20 pixels exist. radioGroupCell1.HorizontalSpace = 20 radioGroupCell1.FlatStyle = FlatStyle.Popup Dim radioGroupCell2 As New RadioGroupCell() radioGroupCell2.Size = New Size(150, 60) radioGroupCell2.Items.AddRange(New String() {"11111", "22222", "33333", "44444", "55555", "66666"}) radioGroupCell2.CheckAlign = ContentAlignment.MiddleLeft '6 radio cells in 3 columns. radioGroupCell2.ColumnCount = 3 'The radio button ranges from top to bottom. radioGroupCell2.FlowDirection = Orientation.Vertical 'Between every 2 lines, 20 pixels exist. radioGroupCell2.VerticalSpace = 20 ' radioGroupCell2.Ellipsis = MultiRowEllipsisMode.EllipsisEnd radioGroupCell2.EllipsisString = "..." Dim template1 As Template = Template.CreateGridTemplate(New Cell() {radioGroupCell1, radioGroupCell2}) gcMultiRow1.Template = template1 gcMultiRow1.RowCount = 3 End Sub
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
GrapeCity.Win.MultiRow.Cell
GrapeCity.Win.MultiRow.RadioGroupCell
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