MultiRow Windows Forms > Developer's Guide > Using MultiRow > Template > 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.
Set the template width using the Template.Width property. The value set is used for the width of rows, column headers, and column footers.
The following code sets the template width to 800 pixels.
Imports GrapeCity.Win.MultiRow ' Assign default template. Dim template1 As Template = Template.Default template1.Width = 800 GcMultiRow1.Template = template1 |
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.
This example modifies the width of a template.
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 |
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; |
You can set the height of rows, column headers, and column footers in the template.
The following sample code modifies the height of rows, column headers, and column footers and changes the background color to display each region clearly.
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 |
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; |