GrapeCity MultiRow Windows Forms Documentation
Border Class
Members  Example 


Represents a rectangular border. The class stores four Line objects for each side and two Line objects for the diagonal.
Object Model
Border ClassLine StructureLine StructureLine StructureLine StructureLine StructureLine StructureLine StructureLine Structure
Syntax
Public Class Border 
   Inherits BorderBase
Dim instance As Border
public class Border : BorderBase 
Example
The following code example shows how to set the Cell or Section border style and color.
class BorderDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private FlowLayoutPanel panel = new FlowLayoutPanel();

        public BorderDemo()
        {
            this.Text = "Border Demo";
            this.Size = new Size(550, 350);

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

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Left;
            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.CreateGridTemplate(1, 100, 40);
            gcMultiRow1.RowCount = 5;
            gcMultiRow1.BackColor = Color.Wheat;
            // Fill values.
            for (int rowIndex = 0; rowIndex < gcMultiRow1.RowCount; rowIndex++)
            {
                gcMultiRow1[rowIndex, 0].Value = rowIndex.ToString();
            }
            // Keep the values when changing MultiRow control's template1.
            gcMultiRow1.RestoreValue = true;
        }
		
		void setNormalBorderToCell_Click(object sender, EventArgs e)
        {
            Template template1 = gcMultiRow1.Template;

            Row row = template1.Row;

            Border normalBorder1 = new Border();

            //The outline borders have the LineStyle.Medium style and Red color.
            //normalBorder1.Outline = new Line(LineStyle.Medium, Color.Red);

            //Except the above, you can set each border in different style or color.
            normalBorder1.Top = new Line(LineStyle.SlantedDashDot, Color.Red);
            normalBorder1.Bottom = new Line(LineStyle.SlantedDashDot, Color.Orange);
            normalBorder1.Left = new Line(LineStyle.SlantedDashDot, Color.Blue);
            normalBorder1.Right = new Line(LineStyle.SlantedDashDot, Color.Green);

            row.Cells[0].Style.Border = normalBorder1;

            // Reload template1.
            this.gcMultiRow1.Template = template1;
        }
Class BorderDemo
    Inherits Form
    Private gcMultiRow1 As New GcMultiRow()
    Private panel As New FlowLayoutPanel()

    Public Sub New()
        Me.Text = "Border Demo"
        Me.Size = New Size(550, 350)

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

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Left
        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.CreateGridTemplate(1, 100, 40)
        gcMultiRow1.RowCount = 5
        gcMultiRow1.BackColor = Color.Wheat
        ' Fill values.
        Dim rowIndex As Integer = 0
        While rowIndex < gcMultiRow1.RowCount
            gcMultiRow1(rowIndex, 0).Value = rowIndex.ToString()
            System.Math.Max(System.Threading.Interlocked.Increment(rowIndex), rowIndex - 1)
        End While
        ' Keep the values when changing MultiRow control's template1.
        gcMultiRow1.RestoreValue = True
    End Sub
	
	Private Sub setNormalBorderToCell_Click(ByVal sender As Object, ByVal e As EventArgs) Handles 
setNormalBorderToCell.Click
        Dim template1 As Template = gcMultiRow1.Template

        Dim row As Row = template1.Row

        Dim normalBorder1 As New Border()

        'The outline borders have the LineStyle.Medium style and Red color.
        'normalBorder1.Outline = new Line(LineStyle.Medium, Color.Red);

        'Except the above, you can set each border in different style or color.
        normalBorder1.Top = New Line(LineStyle.SlantedDashDot, Color.Red)
        normalBorder1.Bottom = New Line(LineStyle.SlantedDashDot, Color.Orange)
        normalBorder1.Left = New Line(LineStyle.SlantedDashDot, Color.Blue)
        normalBorder1.Right = New Line(LineStyle.SlantedDashDot, Color.Green)
        row.Cells(0).Style.Border = normalBorder1

        ' Reload template1.
        Me.gcMultiRow1.Template = template1
    End Sub
Inheritance Hierarchy

System.Object
   GrapeCity.Win.MultiRow.BorderBase
      GrapeCity.Win.MultiRow.Border
         GrapeCity.Win.MultiRow.RoundedBorder

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

Border Members
GrapeCity.Win.MultiRow Namespace
Line Structure
BorderBase Class
RoundedBorder Class
ThreeDBorder Class

 

 


Copyright © GrapeCity, inc. All rights reserved.