GrapeCity MultiRow Windows Forms Documentation
CreateGridTemplate(Int32) Method
Example 


A System.Int32 that indicates the column count.
Creates a standard Template matrix with the specified column count.
Syntax
Public Overloads Shared Function CreateGridTemplate( _
   ByVal columnCount As Integer _
) As Template
Dim columnCount As Integer
Dim value As Template
 
value = Template.CreateGridTemplate(columnCount)
public static Template CreateGridTemplate( 
   int columnCount
)

Parameters

columnCount
A System.Int32 that indicates the column count.

Return Value

A Template that represents a standard Template matrix.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeExceptionThe columnCount is less than or equal to 0.
Remarks
This method generates CornerHeaderCell and ColumnHeaderCell in a ColumnHeaderSection. This method also creates a RowHeaderCell and a default TextBoxCell in the Row section. The text box cell is placed one by one, from left to right. The default ColumnHeaderCell's size is 80,20. The default CornerHeaderCell's size is 36,20. The default RowHeaderCell's size is 36,21. The default TextBoxCell's size is 80,21. The columnCount indicates how many TextBoxCells are in each row.
Example
The following code example shows how to use this method to create a grid template.
class CreateGridTemplateDemo:Form
   {
       private GcMultiRow gcMultiRow1 = new GcMultiRow();
       private FlowLayoutPanel panel = new FlowLayoutPanel();

       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 setFirst_Click(object sender, EventArgs e)
       {
           Template template1 = Template.CreateGridTemplate(5);
           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 setFirst_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setFirst.Click
        Dim template1 As Template = Template.CreateGridTemplate(5)
        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,Int32,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.