MultiRow Windows Forms > Developer's Guide > Using MultiRow > Grid > Expanding Or Collapsing Columns |
The GcMultiRow control provides the functionality to expand or collapse columns.
The column for which the collapse action is performed is displayed as collapsed. In addition, when multiple rows are displayed in a single record, the part that overlaps with the column to be collapsed, is also collapsed.
You can expand or collapse columns using the Expand method or the Collapse method. In addition, it is possible to get the expanded or collapsed state of the column, by using the IsCollapsed property.
Imports GrapeCity.Win.MultiRow Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim textBoxCell1 As TextBoxCell = New TextBoxCell() textBoxCell1.Name = "textBoxCell1" Dim textBoxCell2 As TextBoxCell = New TextBoxCell() textBoxCell2.Name = "textBoxCell2" Dim textBoxCell3 As TextBoxCell = New TextBoxCell() textBoxCell3.Name = "textBoxCell3" GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {textBoxCell1, textBoxCell2, textBoxCell3}) End Sub Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click If GcMultiRow1.Columns(1).IsCollapsed = True Then GcMultiRow1.Columns(1).Expand() Else GcMultiRow1.Columns(1).Collapse() End If End Sub |
using GrapeCity.Win.MultiRow; private void Form1_Load(object sender, EventArgs e) { TextBoxCell textBoxCell1 = new TextBoxCell(); textBoxCell1.Name = "textBoxCell1"; TextBoxCell textBoxCell2 = new TextBoxCell(); textBoxCell2.Name = "textBoxCell2"; TextBoxCell textBoxCell3 = new TextBoxCell(); textBoxCell3.Name = "textBoxCell3"; gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { textBoxCell1, textBoxCell2, textBoxCell3 }); } private void button1_Click(object sender, EventArgs e) { if (gcMultiRow1.Columns[1].IsCollapsed == true) { gcMultiRow1.Columns[1].Expand(); } else { gcMultiRow1.Columns[1].Collapse(); } } |
If the Collapse method is executed, it works as follows.