PowerTools MultiRow for Windows Forms 8.0J
Style プロパティ (Cell)
使用例 

セルレベルで指定されたスタイルを取得または設定します。上位レベルから継承されたスタイルは、これらのスタイルによってオーバーライドされます。
構文
Public Property Style As CellStyle
public CellStyle Style {get; set;}

プロパティ値

セルレベルのスタイルを表すCellStyle値。
解説
GcMultiRowコントロールは、セルのInheritedStyleプロパティで示されたスタイルを使用してセルを表示します。このプロパティは、CellStyle型の他のプロパティからスタイルを継承します。Styleプロパティによって指定されたスタイルは、他のすべてのセルスタイルプロパティによって指定されたスタイルをオーバーライドしますが、必ずしもセルの外観に作用するすべてのスタイルを示すとは限りません。
使用例
次のサンプルコードは、"AlternatingColumnsDefaultCellStyle"と"ColumnsDefaultCellStyle"を実装する方法を示します。フォームが読み込まれるとき、GcMultiRowTemplateを1つ追加します。このTemplateは、アプリケーションが起動された後、奇数番目の列に"ColumnsDefaultCellStyle"を設定し、偶数番目の列に"AlternatingColumnsDefaultCellStyle"を設定します。"AlternatingColumnsDefaultCellStyle"または"ColumnsDefaultCellStyle"を変更する場合は、GcMultiRow.NamedCellStylesの対応する項目を変更するだけで済みます。そうすると、新しいCellStyleが適用されます。このサンプルコードは、NamedCellStyleクラスに示されている詳細なコード例の一部を抜粋したものです。
private void Form1_Load(object sender, EventArgs e)
{
    Template template1 = Template.CreateGridTemplate(20, 50, 21);

    for (int i = 0; i < template1.Row.Cells.Count - 1; i++)
    {
        if (i % 2 == 0)
        {
            //The even columns use the "AlternatingColumnsDefaultCellStyle"
            template1.Row.Cells[i].Style = new NamedCellStyle("AlternatingColumnsDefaultCellStyle");
        }
        else
        {
            //The odd columns use the "ColumnsDefaultCellStyle"
            template1.Row.Cells[i].Style = new NamedCellStyle("ColumnsDefaultCellStyle");
        }
    }
    gcMultiRow1.Template = template1;
    gcMultiRow1.RowCount = 20;
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim template1 As Template = Template.CreateGridTemplate(20, 50, 21)

    For i As Integer = 0 To template1.Row.Cells.Count - 2
        If i Mod 2 = 0 Then
            'The even columns use the "AlternatingColumnsDefaultCellStyle"
            template1.Row.Cells(i).Style = New NamedCellStyle("AlternatingColumnsDefaultCellStyle")
        Else
            'The odd columns use the "ColumnsDefaultCellStyle"
            template1.Row.Cells(i).Style = New NamedCellStyle("ColumnsDefaultCellStyle")
        End If
    Next

    gcMultiRow1.Template = template1
    gcMultiRow1.RowCount = 20
End Sub
参照

Cell クラス
Cell メンバ
CellStyle クラス
GcMultiRow.DefaultCellStyle
GcMultiRow.AlternatingRowsDefaultCellStyle
Section.DefaultCellStyle

 

 


© 2008-2015 GrapeCity inc. All rights reserved.