GrapeCity MultiRow Windows Forms Documentation
Template Width and Height

You can set default values for the width and height of a template. Grids created at runtime are based on the template width and height.

Template Width

Set the template width using the Template.Width property. The value set is used for the width of rows, column headers, and column footers.

Using Code

The following code sets the template width to 800 pixels.

[VB]

Imports GrapeCity.Win.MultiRow

' Assign default template.
Dim template1 As Template = Template.Default
template1.Width = 800
GcMultiRow1.Template = template1

[CS]

using GrapeCity.Win.MultiRow;

' Assign default template.
Template template1 = Template.Default;
template1.Width = 800;
gcMultiRow1.Template = template1;

To modify the width of an exisiting template, assign the GcMultiRow.Template property value to a Template class object and set the width in it. Then reassign the object to the GcMultiRow.Template property.

Using Code

This example modifies the width of a template.

[VB]

Imports GrapeCity.Win.MultiRow

' Assign the default template.
GcMultiRow1.Template = Template.Default
Dim template1 As Template = GcMultiRow1.Template
' Modify template width.
template1.Width = 800
GcMultiRow1.Template = template1

' This code is not applicable.
' GcMultiRow1.Template.Width = 800

[CS]

using GrapeCity.Win.MultiRow;

// Assign the default template.
gcMultiRow1.Template = Template.Default;
Template template1 = gcMultiRow1.Template;
// Modify template width.
template1.Width = 800;
gcMultiRow1.Template = template1;

// This code is not applicable.
// gcMultiRow1.Template.Width = 800;

Template Height

You can set the height of rows, column headers, and column footers in the template.

Using Code

The following sample code modifies the height of rows, column headers, and column footers and changes the background color to display each region clearly.

[VB]

Imports GrapeCity.Win.MultiRow

Dim template As Template = New Template()
template.Row.Height = 20
template.Row.BackColor = Color.LightBlue
template.Row.Border = New Border(LineStyle.Thin, Color.Black)

Dim columnHeaderSection1 As ColumnHeaderSection = New ColumnHeaderSection()
columnHeaderSection1.Height = 20
columnHeaderSection1.BackColor = Color.Azure
template.ColumnHeaders.Add(columnHeaderSection1)

Dim columnFooterSection1 As ColumnFooterSection = New ColumnFooterSection()
columnFooterSection1.Height = 20
columnFooterSection1.BackColor = Color.LightCoral
template.ColumnFooters.Add(columnFooterSection1)

GcMultiRow1.Template = template
GcMultiRow1.RowCount = 100

[CS]

using GrapeCity.Win.MultiRow;

Template template = new Template();
template.Row.Height = 20;
template.Row.BackColor = Color.LightBlue;
template.Row.Border = new Border(LineStyle.Thin, Color.Black);

ColumnHeaderSection columnHeaderSection1 = new ColumnHeaderSection();
columnHeaderSection1.Height = 20;
columnHeaderSection1.BackColor = Color.Azure;
template.ColumnHeaders.Add(columnHeaderSection1);

ColumnFooterSection columnFooterSection1 = new ColumnFooterSection();
columnFooterSection1.Height = 20;
columnFooterSection1.BackColor = Color.LightCoral;
template.ColumnFooters.Add(columnFooterSection1);

gcMultiRow1.Template = template;
gcMultiRow1.RowCount = 100;
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options