GrapeCity MultiRow Windows Forms Documentation
CreateGridTemplate(Int32,Int32,Int32) Method
Example 


A System.Int32 that indicates the column count.
A System.Int32 that indicates the cell width in the Row section.
A System.Int32 that indicates the cell height in the Row section.
Creates a standard Template matrix with the specified column count and cell size.
Syntax
Public Overloads Shared Function CreateGridTemplate( _
   ByVal columnCount As Integer, _
   ByVal cellWidth As Integer, _
   ByVal cellHeight As Integer _
) As Template
Dim columnCount As Integer
Dim cellWidth As Integer
Dim cellHeight As Integer
Dim value As Template
 
value = Template.CreateGridTemplate(columnCount, cellWidth, cellHeight)
public static Template CreateGridTemplate( 
   int columnCount,
   int cellWidth,
   int cellHeight
)

Parameters

columnCount
A System.Int32 that indicates the column count.
cellWidth
A System.Int32 that indicates the cell width in the Row section.
cellHeight
A System.Int32 that indicates the cell height in the Row section.

Return Value

A Template that represents a standard Template matrix.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException

The columnCount is less than or equal to 0.

-or-

The cellWidth is less than or equal to 0.

-or-

The cellHeight is less than or equal to 0.

Remarks
This method is based on the CreateGridTemplate(Int32) method. You can change the default TextBoxCell's initialized size with cellWidth and cellHeight. This size influences the ColumnHeaderCell's width and RowHeaderCell's height.
Example
The following code example shows how to use this method to create a grid template. This code example is part of a larger example provided for the CreateGridTemplate(int) class.
public CreateGridTemplateDemo()
       {
           this.Text = "CreateGridTemplate Demo";
           this.Size = new Size(1000, 750);

           // Initial flow layout panel and add to form.
           this.panel.Dock = DockStyle.Left;
           this.panel.Size = new Size(450, 200);
           this.panel.FlowDirection = FlowDirection.TopDown;
           this.panel.WrapContents = false;
           this.panel.Padding = new Padding(5);
           this.panel.AutoSize = true;
           this.Controls.Add(panel);

           this.gcMultiRow1.Dock = DockStyle.Left;
           this.gcMultiRow1.Width = 550;
           this.Controls.Add(this.gcMultiRow1);

           this.Load += new EventHandler(Form1_Load);

           InitButton();

           this.StartPosition = FormStartPosition.CenterScreen;
       }
       private void Form1_Load(object sender, EventArgs e)
       {
           gcMultiRow1.Template = Template.Default;
           gcMultiRow1.RowCount = 20;
       }
	   void setSecond_Click(object sender, EventArgs e)
        {
            Template template1 = Template.CreateGridTemplate(5, 100, 25);
            this.gcMultiRow1.Template = template1;
        }
Class CreateGridTemplateDemo
    Inherits Form
    Private gcMultiRow1 As New GcMultiRow()
    Private panel As New FlowLayoutPanel()

    Public Sub New()
        Me.Text = "CreateGridTemplate Demo"
        Me.Size = New Size(1000, 750)

        ' Initial flow layout panel and add to form.
        Me.panel.Dock = DockStyle.Left
        Me.panel.Size = New Size(450, 200)
        Me.panel.FlowDirection = FlowDirection.TopDown
        Me.panel.WrapContents = False
        Me.panel.Padding = New Padding(5)
        Me.panel.AutoSize = True
        Me.Controls.Add(panel)

        Me.gcMultiRow1.Dock = DockStyle.Left
        Me.gcMultiRow1.Width = 550
        Me.Controls.Add(Me.gcMultiRow1)

        InitButton()

        Me.StartPosition = FormStartPosition.CenterScreen
    End Sub
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        gcMultiRow1.Template = Template.Default
        gcMultiRow1.RowCount = 20
    End Sub
	 Private Sub setSecond_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setSecond.Click
        Dim template1 As Template = Template.CreateGridTemplate(5, 100, 25)
        Me.gcMultiRow1.Template = template1
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Template Class
Template Members
Overload List
CreateGridTemplate(Int32) Method
CreateGridTemplate(Int32,Int32,Int32,Int32) Method
CreateGridTemplate(Int32,Int32,Int32,Int32,AutoGenerateGridTemplateStyles) Method
CreateGridTemplate(Int32,Int32,Int32,Int32,AutoGenerateGridTemplateStyles,Int32) Method
CreateGridTemplate(IEnumerable<Cell>) Method
CreateGridTemplate(IEnumerable<Cell>,Int32) Method
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles) Method
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles,Int32) Method

 

 


Copyright © GrapeCity, inc. All rights reserved.