PowerTools CalendarGrid for Windows Forms 1.0J
CalendarNamedCellStyle クラス
メンバ  使用例 

名前によってセルスタイルを定義できる特別な CalendarCellStyle を表します。
構文
Public Class CalendarNamedCellStyle 
   Inherits CalendarCellStyle
public class CalendarNamedCellStyle : CalendarCellStyle 
解説
CalendarNamedCellStyleGcCalendarGrid.Styles に追加でき、ユーザーは CalendarObject を継承したクラスで Name によってこのセルスタイルを使用できます。
使用例
次のサンプルコードは、名前付きセルスタイルの実装方法を示します。Cell(0,0) に cellNamedCellStyle を、Rows[0] に rowNamedCellStyle を、Columns[0] に columnNamedCellStyle を、それぞれ設定しています。
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using GrapeCity.Win.CalendarGrid;

namespace CalendarGridSampleCode
{
    class NamedCellStyleDemo : Form
    {
        private GcCalendarGrid gcCalenderGrid = new GcCalendarGrid();

        public NamedCellStyleDemo()
        {
            this.Text = "NamedCellStyle Demo";
            this.Size = new Size(800, 750);

            this.gcCalenderGrid.Dock = DockStyle.Fill;
            this.gcCalenderGrid.Styles.Clear();
            this.Controls.Add(this.gcCalenderGrid);

            this.Load += NamedCellStyleDemo_Load;
            this.StartPosition = FormStartPosition.CenterScreen;
        }
        private void NamedCellStyleDemo_Load(object sender, EventArgs e)
        {
            this.gcCalenderGrid.Template.ColumnCount = 2;
            CalendarNamedCellStyle cellNamedCellStyle = new CalendarNamedCellStyle("cellNamedCellStyle");
            cellNamedCellStyle.BackColor = Color.Red;

            CalendarNamedCellStyle columnNamedCellStyle = new CalendarNamedCellStyle("columnNamedCellStyle");
            columnNamedCellStyle.BackColor = Color.SkyBlue;

            CalendarNamedCellStyle rowNamedCellStyle = new CalendarNamedCellStyle("rowNamedCellStyle");
            rowNamedCellStyle.BackColor = Color.SpringGreen;

            this.gcCalenderGrid.Styles.Add(cellNamedCellStyle);
            this.gcCalenderGrid.Styles.Add(columnNamedCellStyle);
            this.gcCalenderGrid.Styles.Add(rowNamedCellStyle);

            this.gcCalenderGrid.Template.Content.GetCell(0, 0).CellStyleName = "cellNamedCellStyle";
            this.gcCalenderGrid.Template.Content.Columns[0].CellStyleName = "columnNamedCellStyle";
            this.gcCalenderGrid.Template.Content.Rows[0].CellStyleName = "rowNamedCellStyle";
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new NamedCellStyleDemo());
        }
    }
}
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports GrapeCity.Win.CalendarGrid

Namespace CalendarGridSampleCode
    Class NamedCellStyleDemo
        Inherits Form
        Private gcCalenderGrid As New GcCalendarGrid()

        Public Sub New()
            Me.Text = "NamedCellStyle Demo"
            Me.Size = New Size(800, 750)

            Me.gcCalenderGrid.Dock = DockStyle.Fill
            Me.gcCalenderGrid.Styles.Clear()
            Me.Controls.Add(Me.gcCalenderGrid)

            AddHandler Me.Load, AddressOf NamedCellStyleDemo_Load
            Me.StartPosition = FormStartPosition.CenterScreen
        End Sub
        Private Sub NamedCellStyleDemo_Load(sender As Object, e As EventArgs)
            Me.gcCalenderGrid.Template.ColumnCount = 2
            Dim cellNamedCellStyle As New CalendarNamedCellStyle("cellNamedCellStyle")
            cellNamedCellStyle.BackColor = Color.Red

            Dim columnNamedCellStyle As New CalendarNamedCellStyle("columnNamedCellStyle")
            columnNamedCellStyle.BackColor = Color.SkyBlue

            Dim rowNamedCellStyle As New CalendarNamedCellStyle("rowNamedCellStyle")
            rowNamedCellStyle.BackColor = Color.SpringGreen

            Me.gcCalenderGrid.Styles.Add(cellNamedCellStyle)
            Me.gcCalenderGrid.Styles.Add(columnNamedCellStyle)
            Me.gcCalenderGrid.Styles.Add(rowNamedCellStyle)

            Me.gcCalenderGrid.Template.Content.GetCell(0, 0).CellStyleName = "cellNamedCellStyle"
            Me.gcCalenderGrid.Template.Content.Columns(0).CellStyleName = "columnNamedCellStyle"
            Me.gcCalenderGrid.Template.Content.Rows(0).CellStyleName = "rowNamedCellStyle"
        End Sub

        <STAThreadAttribute> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New NamedCellStyleDemo())
        End Sub
    End Class
End Namespace
継承階層

System.Object
   GrapeCity.Win.CalendarGrid.CalendarCellStyle
      GrapeCity.Win.CalendarGrid.CalendarNamedCellStyle
         GrapeCity.Win.CalendarGrid.CalendarConditionalCellStyle
         GrapeCity.Win.CalendarGrid.CalendarDynamicCellStyle

参照

CalendarNamedCellStyle メンバ
GrapeCity.Win.CalendarGrid 名前空間

 

 


© 2014 GrapeCity inc. All rights reserved.