GrapeCity MultiRow Windows Forms Documentation
Adding Column Headers

Use the ColumnHeaderSectionCollection object in the Template.ColumnHeaders property to work with column headers in the template.

Adding a Column Header

Create an instance of the ColumnHeaderSection class and use the ColumnHeaderSectionCollection.Add method to add a column header in code.

Using Code

This example creates an instance of the ColumnHeaderSection class and adds a column header.

[VB]

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

[CS]

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;

Deleting a Column Header

Use ColumnHeaderSectionCollection.Remove or RemoveAt methods to delete the column header.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options