GrapeCity MultiRow Windows Forms Documentation
CombinedCellStyle Class
Members  Example 


Represents a special CellStyle that combines several cell style effects to generate a new CellStyle object. This class cannot be inherited.
Object Model
CombinedCellStyle ClassCellStyleCollection ClassCellStyle Class
Syntax
<TypeConverterAttribute("GrapeCity.Win.MultiRow.CombinedCellStyleConverter, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
Public NotInheritable Class CombinedCellStyle 
   Inherits CellStyle
Dim instance As CombinedCellStyle
[TypeConverter("GrapeCity.Win.MultiRow.CombinedCellStyleConverter, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
public sealed class CombinedCellStyle : CellStyle 
Remarks

This class allows you to combine two or more existing CellStyles without having to set properties one by one. You can combine any type of CellStyle including the CombinedCellStyle itself.

Be careful not to create a circular reference style or there may be unexpected results.
Example
The following code example shows how to combine two predefined CellStyles to generate the required CellStyle object. The program sets the RoundedBorder to alternating columns. This code example is part of a larger example provided for the NamedCellStyle class.
void SetBorderToAlternatingColumns(object sender, EventArgs e)
        {
            CellStyle borderCellStyle = new CellStyle();
            borderCellStyle.Border = new RoundedBorder(LineStyle.Thin, Color.Gray, 0.5f);

            CellStyle colorStyle = new CellStyle();
            colorStyle.BackColor = Color.Yellow;

            //The combinedCellStyle1 will merge borderCellStyle and AlternatingColumnsDefaultCellStyle.
            CombinedCellStyle combinedCellStyle1 = new CombinedCellStyle();
            combinedCellStyle1.Items.AddRange(new CellStyle[] { borderCellStyle, colorStyle });
            this.gcMultiRow1.NamedCellStyles["AlternatingColumnsDefaultCellStyle"] = combinedCellStyle1;
        }
Private Sub SetBorderToAlternatingColumns(ByVal sender As Object, ByVal e As EventArgs) Handles setBorder.Click
        Dim borderCellStyle As New CellStyle()
        borderCellStyle.Border = New RoundedBorder(LineStyle.Thin, Color.Gray, 0.5F)

        Dim colorStyle As New CellStyle()
        colorStyle.BackColor = Color.Yellow

        'The combinedCellStyle1 will merge borderCellStyle and AlternatingColumnsDefaultCellStyle.
        Dim combinedCellStyle1 As New CombinedCellStyle()
        combinedCellStyle1.Items.AddRange(New CellStyle() {borderCellStyle, colorStyle})
        Me.gcMultiRow1.NamedCellStyles("AlternatingColumnsDefaultCellStyle") = combinedCellStyle1
    End Sub
Inheritance Hierarchy

System.Object
   GrapeCity.Win.MultiRow.CellStyle
      GrapeCity.Win.MultiRow.CombinedCellStyle

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

CombinedCellStyle Members
GrapeCity.Win.MultiRow Namespace
CellStyle Class
DynamicCellStyle Class
NamedCellStyle Class
ConditionalCellStyle Class

 

 


Copyright © GrapeCity, inc. All rights reserved.