GrapeCity.Win.CalendarGrid.v20 アセンブリ > GrapeCity.Win.CalendarGrid 名前空間 : CalendarConditionalCellStyle クラス |
Public Class CalendarConditionalCellStyle Inherits CalendarNamedCellStyle
public class CalendarConditionalCellStyle : CalendarNamedCellStyle
using System; using System.Windows.Forms; using System.Drawing; using GrapeCity.Win.CalendarGrid; namespace CalendarGridSampleCode { public class ConditionalCellStyleDemo : Form { private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid(); private Label label1 = new Label(); public ConditionalCellStyleDemo() { this.Text = "ConditionalCellStyle Demo"; this.Size = new Size(600, 400); this.gcCalendarGrid1.Dock = DockStyle.Fill; this.Controls.Add(this.gcCalendarGrid1); label1.Text = "When specified date match condition, the corresponding background will be painted."; label1.Height = 50; label1.Dock = DockStyle.Bottom; label1.BackColor = SystemColors.Info; label1.ForeColor = Color.Red; this.Controls.Add(label1); this.Load += Form1_Load; this.StartPosition = FormStartPosition.CenterScreen; } private void Form1_Load(object sender, EventArgs e) { CalendarCellStyle cellStyle1 = new CalendarCellStyle(); cellStyle1.BackColor = Color.Lime; CalendarCellStyle cellStyle2 = new CalendarCellStyle(); cellStyle2.BackColor = Color.Yellow; CalendarCellStyle cellStyle3 = new CalendarCellStyle(); cellStyle3.BackColor = Color.Red; CalendarConditionalCellStyleItem item1 = new CalendarConditionalCellStyleItem(cellStyle1, ConditionalStyleOperator.IsMonday); CalendarConditionalCellStyleItem item2 = new CalendarConditionalCellStyleItem(cellStyle2, ConditionalStyleOperator.IsFriday); CalendarConditionalCellStyleItem item3 = new CalendarConditionalCellStyleItem(cellStyle3, ConditionalStyleOperator.IsTrailingDay); CalendarConditionalCellStyle conditionalStyle1 = new CalendarConditionalCellStyle("defaultCalendarConditionalStyle"); conditionalStyle1.Items.Add(item1); conditionalStyle1.Items.Add(item2); conditionalStyle1.Items.Add(item3); this.gcCalendarGrid1.Styles.Clear(); this.gcCalendarGrid1.Template.Content.GetCell(0, 0).CellStyleName = "defaultCalendarConditionalStyle"; this.gcCalendarGrid1.Styles.Add(conditionalStyle1); } [STAThreadAttribute()] public static void Main() { Application.EnableVisualStyles(); Application.Run(new ConditionalCellStyleDemo()); } } }
Imports System.Windows.Forms Imports System.Drawing Imports GrapeCity.Win.CalendarGrid Namespace CalendarGridSampleCode Public Class ConditionalCellStyleDemo Inherits Form Private gcCalendarGrid1 As New GcCalendarGrid() Private label1 As New Label() Public Sub New() Me.Text = "ConditionalCellStyle Demo" Me.Size = New Size(600, 400) Me.gcCalendarGrid1.Dock = DockStyle.Fill Me.Controls.Add(Me.gcCalendarGrid1) label1.Text = "When specified date match condition, the corresponding background will be painted." label1.Height = 50 label1.Dock = DockStyle.Bottom label1.BackColor = SystemColors.Info label1.ForeColor = Color.Red Me.Controls.Add(label1) AddHandler Me.Load, AddressOf Form1_Load Me.StartPosition = FormStartPosition.CenterScreen End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Dim cellStyle1 As New CalendarCellStyle() cellStyle1.BackColor = Color.Lime Dim cellStyle2 As New CalendarCellStyle() cellStyle2.BackColor = Color.Yellow Dim cellStyle3 As New CalendarCellStyle() cellStyle3.BackColor = Color.Red Dim item1 As New CalendarConditionalCellStyleItem(cellStyle1, ConditionalStyleOperator.IsMonday) Dim item2 As New CalendarConditionalCellStyleItem(cellStyle2, ConditionalStyleOperator.IsFriday) Dim item3 As New CalendarConditionalCellStyleItem(cellStyle3, ConditionalStyleOperator.IsTrailingDay) Dim conditionalStyle1 As New CalendarConditionalCellStyle("defaultCalendarConditionalStyle") conditionalStyle1.Items.Add(item1) conditionalStyle1.Items.Add(item2) conditionalStyle1.Items.Add(item3) Me.gcCalendarGrid1.Styles.Clear() Me.gcCalendarGrid1.Template.Content.GetCell(0, 0).CellStyleName = "defaultCalendarConditionalStyle" Me.gcCalendarGrid1.Styles.Add(conditionalStyle1) End Sub <STAThreadAttribute> _ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New ConditionalCellStyleDemo()) End Sub End Class End Namespace
System.Object
GrapeCity.Win.CalendarGrid.CalendarCellStyle
GrapeCity.Win.CalendarGrid.CalendarNamedCellStyle
GrapeCity.Win.CalendarGrid.CalendarConditionalCellStyle