GrapeCity CalendarGrid for Windows Forms 2.0J
CalendarCellStyle クラス
メンバ  使用例 

個々の CalendarCell に適用される書式とスタイルの情報を表します。
構文
Public Class CalendarCellStyle 
public class CalendarCellStyle 
解説
CalendarCellStyle は、CalendarObject を継承したクラスで使用できます。
使用例
次のサンプルコードは、セルスタイルの使用方法を示します。
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GrapeCity.Win.CalendarGrid;

namespace CalendarGridSampleCode
{
    public class CellStyleDemo : Form
    {
        private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid();
        private TableLayoutPanel tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
        private TableLayoutPanel tableLayoutPanel2 = new TableLayoutPanel();
        private Button button1 = new Button();
        private Button button2 = new Button();
        private Button button3 = new Button();

        public CellStyleDemo()
        {
            this.tableLayoutPanel1.ColumnCount = 1;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 2;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(554, 426);

            this.gcCalendarGrid1.Dock = DockStyle.Fill;
            this.gcCalendarGrid1.TitleHeader.Children.Clear();
            this.tableLayoutPanel1.Controls.Add(this.gcCalendarGrid1, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);

            this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.button1.Text = "SetAppearanceProperty";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += SetAppearanceProperty;

            this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.button2.Text = "SetTextProperty";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += SetTextProperty;

            this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
            this.button3.Text = "SetBorderProperty";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += SetBorder;

            this.tableLayoutPanel2.ColumnCount = 4;
            this.tableLayoutPanel2.RowCount = 1;
            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3f));
            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3f));
            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3f));
        
            this.tableLayoutPanel2.Controls.Add(this.button1, 0, 0);
            this.tableLayoutPanel2.Controls.Add(this.button2, 1, 0);
            this.tableLayoutPanel2.Controls.Add(this.button3, 2, 0);
            this.tableLayoutPanel2.Dock = DockStyle.Fill;

            this.Text = "CellStyle Demo";
            this.Size = new Size(800, 700);
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Controls.Add(this.tableLayoutPanel1);
        }

        private void SetAppearanceProperty(object sender, EventArgs e)
        {
            this.SetAppearanceProperty();
        }

        private void SetTextProperty(object sender, EventArgs e)
        {
            this.SetTextProperty();
        }

        private void SetBorder(object sender, EventArgs e)
        {
            this.SetBorder();
        }

        private void SetAppearanceProperty()
        {
            this.gcCalendarGrid1.Template.Content.GetCell(2, 0).Value = "SampleText";
            this.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.BackColor = Color.SkyBlue;
            this.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.ForeColor = Color.SaddleBrown;
            this.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter;
            this.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.PatternEffect = new CalendarPatternEffect(CalendarPatternStyle.DottedGrid, Color.Red);
        }

        private void SetTextProperty()
        {         
            this.gcCalendarGrid1.Template.Content.GetCell(1, 0).Value = "SampleText";
            this.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.UseCompatibleTextRendering = CalendarGridTriState.True;
            this.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.TextAngle = 60;
            this.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.TextVertical = CalendarGridTriState.True;  
        }

        private void SetBorder()
        {
            this.gcCalendarGrid1.Template.Content.CellStyle.BottomBorder = new CalendarBorderLine(Color.Salmon, BorderLineStyle.DashDotDot);
            this.gcCalendarGrid1.Template.Content.CellStyle.TopBorder = new CalendarBorderLine(Color.Salmon, BorderLineStyle.DashDotDot);
            this.gcCalendarGrid1.Template.Content.CellStyle.RightBorder = new CalendarBorderLine(Color.SlateBlue, BorderLineStyle.Double);
            this.gcCalendarGrid1.Template.Content.CellStyle.LeftBorder = new CalendarBorderLine(Color.SlateBlue, BorderLineStyle.Double);
        }

        [STAThreadAttribute]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new CellStyleDemo());
        }
    }
}
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports GrapeCity.Win.CalendarGrid

Namespace CalendarGridSampleCode
    Public Class CellStyleDemo
        Inherits Form
        Private gcCalendarGrid1 As New GcCalendarGrid()
        Private tableLayoutPanel1 As TableLayoutPanel = New System.Windows.Forms.TableLayoutPanel()
        Private tableLayoutPanel2 As New TableLayoutPanel()
        Private button1 As New Button()
        Private button2 As New Button()
        Private button3 As New Button()

        Public Sub New()
            Me.tableLayoutPanel1.ColumnCount = 1
            Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0F))
            Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0)
            Me.tableLayoutPanel1.Name = "tableLayoutPanel1"
            Me.tableLayoutPanel1.RowCount = 2
            Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90.0F))
            Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.0F))
            Me.tableLayoutPanel1.Size = New System.Drawing.Size(554, 426)

            Me.gcCalendarGrid1.Dock = DockStyle.Fill
            Me.gcCalendarGrid1.TitleHeader.Children.Clear()
            Me.tableLayoutPanel1.Controls.Add(Me.gcCalendarGrid1, 0, 0)
            Me.tableLayoutPanel1.Controls.Add(Me.tableLayoutPanel2, 0, 1)

            Me.button1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.button1.Text = "SetAppearanceProperty"
            Me.button1.UseVisualStyleBackColor = True
            AddHandler Me.button1.Click, AddressOf SetAppearanceProperty

            Me.button2.Dock = System.Windows.Forms.DockStyle.Fill
            Me.button2.Text = "SetTextProperty"
            Me.button2.UseVisualStyleBackColor = True
            AddHandler Me.button2.Click, AddressOf SetTextProperty

            Me.button3.Dock = System.Windows.Forms.DockStyle.Fill
            Me.button3.Text = "SetBorderProperty"
            Me.button3.UseVisualStyleBackColor = True
            AddHandler Me.button3.Click, AddressOf SetBorder

            Me.tableLayoutPanel2.ColumnCount = 4
            Me.tableLayoutPanel2.RowCount = 1
            Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F))
            Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F))
            Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F))

            Me.tableLayoutPanel2.Controls.Add(Me.button1, 0, 0)
            Me.tableLayoutPanel2.Controls.Add(Me.button2, 1, 0)
            Me.tableLayoutPanel2.Controls.Add(Me.button3, 2, 0)
            Me.tableLayoutPanel2.Dock = DockStyle.Fill

            Me.Text = "CellStyle Demo"
            Me.Size = New Size(800, 700)
            Me.StartPosition = FormStartPosition.CenterScreen
            Me.Controls.Add(Me.tableLayoutPanel1)
        End Sub

        Private Sub SetAppearanceProperty(sender As Object, e As EventArgs)
            Me.SetAppearanceProperty()
        End Sub

        Private Sub SetTextProperty(sender As Object, e As EventArgs)
            Me.SetTextProperty()
        End Sub

        Private Sub SetBorder(sender As Object, e As EventArgs)
            Me.SetBorder()
        End Sub

        Private Sub SetAppearanceProperty()
            Me.gcCalendarGrid1.Template.Content.GetCell(2, 0).Value = "SampleText"
            Me.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.BackColor = Color.SkyBlue
            Me.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.ForeColor = Color.SaddleBrown
            Me.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter
            Me.gcCalendarGrid1.Template.Content.GetCell(2, 0).CellStyle.PatternEffect = New CalendarPatternEffect(CalendarPatternStyle.DottedGrid, Color.Red)
        End Sub

        Private Sub SetTextProperty()
            Me.gcCalendarGrid1.Template.Content.GetCell(1, 0).Value = "SampleText"
            Me.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.UseCompatibleTextRendering = CalendarGridTriState.[True]
            Me.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.TextAngle = 60
            Me.gcCalendarGrid1.Template.Content.GetCell(1, 0).CellStyle.TextVertical = CalendarGridTriState.[True]
        End Sub

        Private Sub SetBorder()
            Me.gcCalendarGrid1.Template.Content.CellStyle.BottomBorder = New CalendarBorderLine(Color.Salmon, BorderLineStyle.DashDotDot)
            Me.gcCalendarGrid1.Template.Content.CellStyle.TopBorder = New CalendarBorderLine(Color.Salmon, BorderLineStyle.DashDotDot)
            Me.gcCalendarGrid1.Template.Content.CellStyle.RightBorder = New CalendarBorderLine(Color.SlateBlue, BorderLineStyle.[Double])
            Me.gcCalendarGrid1.Template.Content.CellStyle.LeftBorder = New CalendarBorderLine(Color.SlateBlue, BorderLineStyle.[Double])
        End Sub

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

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

参照

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

 

 


c 2008 GrapeCity inc. All rights reserved.