GrapeCity MultiRow Windows Forms Documentation
DefaultCellStyle Property (GcMultiRow)
Example 


Gets or sets default styles used by all cells in the entire control (including header cells), in a row, or in a columnHeader, or in a columnFooter.
Syntax
<SRCategoryAttribute("Appearance")>
<RefreshPropertiesAttribute(RefreshProperties.All)>
<SRDescriptionAttribute("Indicates the default CellStyle that is applied to the GcMultiRow cells if no other style is set.
")>
Public Property DefaultCellStyle As CellStyle
Dim instance As GcMultiRow
Dim value As CellStyle
 
instance.DefaultCellStyle = value
 
value = instance.DefaultCellStyle
[SRCategory("Appearance")]
[RefreshProperties(RefreshProperties.All)]
[SRDescription("Indicates the default CellStyle that is applied to the GcMultiRow cells if no other style is set.
")]
public CellStyle DefaultCellStyle {get; set;}

Property Value

A CellStyle that represents the default styles used by all cells in the control (including header cells), row, column header, or column footer.
Remarks

The GcMultiRow control displays its cells using the styles indicated by the cell InheritedStyle property, which inherits styles from other properties of type CellStyle. The styles specified with the DefaultCellStyle property affect all cells except when overridden by the styles specified with the following properties:

When getting this property, a CellStyle with default values is created if the property has not already been accessed. This can cause a performance impact when getting this property for many rows. When possible, use a single CellStyle to set this property for multiple rows.

Example
The following code example shows how to use this property to customize the cell's appearance. This code example is part of a larger example provided for the CellStyle class.
void Form1_Load(object sender, EventArgs e)
        {
            // All cell's will use default cell style.
            gcMultiRow1.RowsDefaultCellStyle.BackColor = Color.Black;
            gcMultiRow1.RowsDefaultCellStyle.ForeColor = Color.White;
            gcMultiRow1.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(100, SystemColors.Highlight);
            gcMultiRow1.RowsDefaultCellStyle.TextAlign = MultiRowContentAlignment.MiddleRight;

            // The cell's in alternating Rows
            gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientColors = new Color[] { Color.FromArgb(25, 25, 25), 
Color.FromArgb(75, 75, 75) };
            gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientDirection = GradientDirection.Backward;
            gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientStyle = GradientStyle.Horizontal;

            // Row header cells
            gcMultiRow1.RowsDefaultHeaderCellStyle.BackColor = Color.FromArgb(75, 75, 75);
            gcMultiRow1.RowsDefaultHeaderCellStyle.ForeColor = Color.White;

            // column header cells.
            gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.BackColor = Color.FromArgb(75, 75, 75);
            gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.ForeColor = Color.FromArgb(200, 200, 200);
            gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.TextAlign = MultiRowContentAlignment.MiddleCenter;
            gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.UseCompatibleTextRendering = MultiRowTriState.True;
            gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.TextEffect = TextEffect.SunkenLite;

            // All cells in specific row.
            gcMultiRow1.Rows[0].DefaultCellStyle.PatternColor = Color.Gray;
            gcMultiRow1.Rows[0].DefaultCellStyle.PatternStyle = MultiRowHatchStyle.BackwardDiagonal;
            gcMultiRow1.Rows[0].DefaultCellStyle.Font = new Font(Control.DefaultFont, FontStyle.Underline);

            // Change single cell
            gcMultiRow1[0, 0].Style.UseCompatibleTextRendering = MultiRowTriState.True;
            gcMultiRow1[0, 0].Style.TextAngle = 30;
            gcMultiRow1[0, 0].Style.Format = "#0.00%";
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        ' All cell's will use default cell style.
        gcMultiRow1.RowsDefaultCellStyle.BackColor = Color.Black
        gcMultiRow1.RowsDefaultCellStyle.ForeColor = Color.White
        gcMultiRow1.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(100, SystemColors.Highlight)
        gcMultiRow1.RowsDefaultCellStyle.TextAlign = MultiRowContentAlignment.MiddleRight

        ' The cell's in alternating Rows
        gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientColors = New Color() {Color.FromArgb(25, 25, 25), 
Color.FromArgb(75, 75, 75)}
        gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientDirection = GradientDirection.Backward
        gcMultiRow1.AlternatingRowsDefaultCellStyle.GradientStyle = GradientStyle.Horizontal

        ' Row header cells
        gcMultiRow1.RowsDefaultHeaderCellStyle.BackColor = Color.FromArgb(75, 75, 75)
        gcMultiRow1.RowsDefaultHeaderCellStyle.ForeColor = Color.White

        ' column header cells.
        gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.BackColor = Color.FromArgb(75, 75, 75)
        gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.ForeColor = Color.FromArgb(200, 200, 200)
        gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.TextAlign = MultiRowContentAlignment.MiddleCenter
        gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.UseCompatibleTextRendering = MultiRowTriState.True
        gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle.TextEffect = TextEffect.SunkenLite

        ' All cells in specific row.
        gcMultiRow1.Rows(0).DefaultCellStyle.PatternColor = Color.Gray
        gcMultiRow1.Rows(0).DefaultCellStyle.PatternStyle = MultiRowHatchStyle.BackwardDiagonal
        gcMultiRow1.Rows(0).DefaultCellStyle.Font = New Font(Control.DefaultFont, FontStyle.Underline)

        ' Change single cell
        gcMultiRow1(0, 0).Style.UseCompatibleTextRendering = MultiRowTriState.True
        gcMultiRow1(0, 0).Style.TextAngle = 30
        gcMultiRow1(0, 0).Style.Format = "#0.00%"
    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

GcMultiRow Class
GcMultiRow Members

 

 


Copyright © GrapeCity, inc. All rights reserved.