MultiRow Windows Forms > Developer's Guide > Using MultiRow > Template > Adding Column Headers |
Use the ColumnHeaderSectionCollection object in the Template.ColumnHeaders property to work with column headers in the template.
Create an instance of the ColumnHeaderSection class and use the ColumnHeaderSectionCollection.Add method to add a column header in code.
This example creates an instance of the ColumnHeaderSection class and adds a column header.
Imports GrapeCity.Win.MultiRow Dim template As Template = New Template() Dim columnHeaderSection As ColumnHeaderSection = new ColumnHeaderSection() Dim columnHeaderCell1 As ColumnHeaderCell = New ColumnHeaderCell() columnHeaderCell1.Location = New Point(0, 0) columnHeaderCell1.Value = "Col1" columnHeaderSection.Cells.Add(columnHeaderCell1) columnHeaderSection.Height = columnHeaderCell1.Height Dim textBoxCell1 As TextBoxCell = New TextBoxCell() textBoxCell1.Name = "textBoxCell1" textBoxCell1.Location = New Point(0, 0) template.Width = textBoxCell1.Width template.Row.Cells.Add(textBoxCell1) template.Row.Height = textBoxCell1.Height template.ColumnHeaders.Add(columnHeaderSection) GcMultiRow1.Template = template GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; Template template = new Template(); ColumnHeaderSection columnHeaderSection = new ColumnHeaderSection(); ColumnHeaderCell columnHeaderCell1 = new ColumnHeaderCell(); columnHeaderCell1.Location = new Point(0, 0); columnHeaderCell1.Value = "Col1"; columnHeaderSection.Cells.Add(columnHeaderCell1); columnHeaderSection.Height = columnHeaderCell1.Height; TextBoxCell textBoxCell1 = new TextBoxCell(); textBoxCell1.Name = "textBoxCell1"; textBoxCell1.Location = new Point(0, 0); template.Width = textBoxCell1.Width; template.Row.Cells.Add(textBoxCell1); template.Row.Height = textBoxCell1.Height; template.ColumnHeaders.Add(columnHeaderSection); gcMultiRow1.Template = template; gcMultiRow1.RowCount = 10; |
Use ColumnHeaderSectionCollection.Remove or RemoveAt methods to delete the column header.