GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : FreezeLines Property |
<SRDescriptionAttribute("Indicates the style of the freeze lines.")> <SRCategoryAttribute("Appearance")> Public Property FreezeLines As FreezeLines
Dim instance As GcMultiRow Dim value As FreezeLines instance.FreezeLines = value value = instance.FreezeLines
[SRDescription("Indicates the style of the freeze lines.")] [SRCategory("Appearance")] public FreezeLines FreezeLines {get; set;}
To keep some cells or rows always visible use the FreezeTopRowCount, FreezeBottomRowCount, FreezeLeftCellIndex, and FreezeRightCellIndex properties.
Set this property to change each freeze line style.
public class FreezeDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private FlowLayoutPanel panel = new FlowLayoutPanel(); public FreezeDemo() { this.Text = "Freeze Demo"; this.Size = new Size(600, 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.Controls.Add(panel); // Add MultiRow to form this.gcMultiRow1.Dock = DockStyle.Left; this.gcMultiRow1.Width = 400; this.Controls.Add(this.gcMultiRow1); // Tip label Label label = new Label(); label.Height = 20; label.Dock = DockStyle.Bottom; label.BackColor = SystemColors.Info; label.Text = "Yow can try to click buttons and scroll MultiRow control. You will find the frozen area does not scroll."; this.Controls.Add(label); this.Load += new EventHandler(Form1_Load); InitButton(); } private void Form1_Load(object sender, EventArgs e) { // Create a grid like template with 10 columns. The cells in template will be named "textBoxCell1", "textBoxCell2"..."textBoxCell10". gcMultiRow1.Template = Template.CreateGridTemplate(10); gcMultiRow1.RowCount = 30; // Initialize cell value for MultiRow control. for (int i = 0; i < gcMultiRow1.RowCount; i++) { gcMultiRow1.SetValue(i, "textBoxCell1", i); } } void setFreezeStyleButton_Click(object sender, EventArgs e) { FreezeLines freezeLines = this.gcMultiRow1.FreezeLines; if (this.gcMultiRow1.FreezeLines.All == new Line(LineStyle.Thin, Color.Black)) { // set top freeze line to a thin red line. freezeLines.Top = new Line(LineStyle.Thin, Color.Red); // set top freeze line to a thin red line. freezeLines.Bottom = new Line(LineStyle.MediumDashed, Color.Green); // set top freeze line to a thin red line. freezeLines.Right = new Line(LineStyle.Double, Color.Blue); // hide left freeze line, but freeze behavior still take effect. freezeLines.Left = Line.Empty; } else { freezeLines.All = new Line(LineStyle.Thin, Color.Black); } this.gcMultiRow1.FreezeLines = freezeLines; }
Public Class FreezeDemo Inherits Form Private gcMultiRow1 As New GcMultiRow() Private panel As New FlowLayoutPanel() Public Sub New() Me.Text = "Freeze Demo" Me.Size = New Size(600, 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.Controls.Add(panel) ' Add MultiRow to form Me.gcMultiRow1.Dock = DockStyle.Left Me.gcMultiRow1.Width = 400 Me.Controls.Add(Me.gcMultiRow1) ' Tip label Dim label As New Label() label.Height = 20 label.Dock = DockStyle.Bottom label.BackColor = SystemColors.Info label.Text = "Yow can try to click buttons and scroll MultiRow control. You will find the frozen area does not scroll." Me.Controls.Add(label) InitButton() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load ' Create a grid like template with 10 columns. The cells in template will be named "textBoxCell1", "textBoxCell2"..."textBoxCell10". gcMultiRow1.Template = Template.CreateGridTemplate(10) gcMultiRow1.RowCount = 30 ' Initialize cell value for MultiRow control. For i As Integer = 0 To gcMultiRow1.RowCount - 1 gcMultiRow1.SetValue(i, "textBoxCell1", i) Next End Sub Private Sub setFreezeStyleButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setFreezeStyleButton.Click Dim freezeLines As FreezeLines = Me.gcMultiRow1.FreezeLines If Me.gcMultiRow1.FreezeLines.All = New Line(LineStyle.Thin, Color.Black) Then ' set top freeze line to a thin red line. freezeLines.Top = New Line(LineStyle.Thin, Color.Red) ' set top freeze line to a thin red line. freezeLines.Bottom = New Line(LineStyle.MediumDashed, Color.Green) ' set top freeze line to a thin red line. freezeLines.Right = New Line(LineStyle.Double, Color.Blue) ' hide left freeze line, but freeze behavior still take effect. freezeLines.Left = Line.Empty Else freezeLines.All = New Line(LineStyle.Thin, Color.Black) End If Me.gcMultiRow1.FreezeLines = freezeLines End Sub
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