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 NavigationBarDemo : 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();
private Button button4 = new Button();
public NavigationBarDemo()
{
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 = "SetHeaderFooter";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += SetHeaderFooter_Click;
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.Text = "AddTittleButton";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += AddButton_Click;
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
this.button3.Text = "AddCaption";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += AddCaption_Click;
this.button4.Dock = System.Windows.Forms.DockStyle.Fill;
this.button4.Text = "AddLabel";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += AddLabel_Click;
this.tableLayoutPanel2.ColumnCount = 4;
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25f));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25f));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25f));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25f));
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.Controls.Add(this.button4, 3, 0);
this.tableLayoutPanel2.Dock = DockStyle.Fill;
this.Text = "HeaderFooter Demo";
this.Size = new Size(800, 700);
this.StartPosition = FormStartPosition.CenterScreen;
this.Controls.Add(this.tableLayoutPanel1);
}
private void SetHeaderFooter_Click(object sender, EventArgs e)
{
this.SetHeaderFooterProperty();
}
private void AddButton_Click(object sender, EventArgs e)
{
this.AddTitleButton();
}
private void AddCaption_Click(object sender, EventArgs e)
{
this.AddCaption();
}
private void AddLabel_Click(object sender, EventArgs e)
{
this.AddLabel();
}
private void SetHeaderFooterProperty()
{
this.gcCalendarGrid1.TitleHeader.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
this.gcCalendarGrid1.TitleHeader.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gcCalendarGrid1.TitleHeader.ForeColor = System.Drawing.Color.RoyalBlue;
this.gcCalendarGrid1.TitleHeader.Margin = new System.Windows.Forms.Padding(5);
this.gcCalendarGrid1.TitleHeader.Padding = new System.Windows.Forms.Padding(5);
this.gcCalendarGrid1.TitleHeader.PatternEffect = new GrapeCity.Win.CalendarGrid.CalendarPatternEffect(GrapeCity.Win.CalendarGrid.CalendarPatternStyle.DiagonalCross, System.Drawing.Color.Bisque);
}
private void AddTitleButton()
{
CalendarTitleButton previousButton = new CalendarTitleButton();
previousButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.Previous;
previousButton.Name = "calendarTitleButton4";
previousButton.Text = "<<";
previousButton.ToolTipText = "{0}";
CalendarTitleButton nextButton = new CalendarTitleButton();
nextButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.Next;
nextButton.Name = "calendarTitleButton4";
nextButton.Text = ">>";
nextButton.ToolTipText = "{0}";
CalendarTitleButton gotoDateButton = new CalendarTitleButton();
gotoDateButton.BackColor = System.Drawing.Color.AliceBlue;
gotoDateButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.GotoDate;
gotoDateButton.DateFormat = "{MonthDay}";
gotoDateButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
gotoDateButton.GotoDate = new System.DateTime(2014, 2, 14, 0, 0, 0, 0);
gotoDateButton.Name = "calendarTitleButton5";
gotoDateButton.Text = "{0}";
gotoDateButton.ToolTipText = "{0}";
this.gcCalendarGrid1.TitleHeader.Children.Add(previousButton);
this.gcCalendarGrid1.TitleHeader.Children.Add(nextButton);
this.gcCalendarGrid1.TitleHeader.Children.Add(gotoDateButton);
}
private void AddCaption()
{
CalendarTitleCaption titleCaption = new CalendarTitleCaption();
titleCaption.DateFormat = "yyyy年M月 (ggge年)";
titleCaption.DateFormatType = GrapeCity.Win.CalendarGrid.CalendarDateFormatType.InputMan;
titleCaption.Name = "calendarTitleCaption2";
titleCaption.Text = "{0}";
titleCaption.HorizontalAlignment = CalendarHorizontalAlignment.Center;
this.gcCalendarGrid1.TitleHeader.Children.Add(titleCaption);
}
private void AddLabel()
{
CalendarTitleLabel titleLabel = new CalendarTitleLabel();
titleLabel.Name = "calendarTitleLabel1";
titleLabel.Text = "Text";
titleLabel.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
titleLabel.HorizontalAlignment = CalendarHorizontalAlignment.Right;
this.gcCalendarGrid1.TitleHeader.Children.Add(titleLabel);
}
[STAThreadAttribute]
public static void Main()
{
Application.EnableVisualStyles();
Application.Run(new NavigationBarDemo());
}
}
}
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 NavigationBarDemo
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()
Private button4 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 = "SetHeaderFooter"
Me.button1.UseVisualStyleBackColor = True
AddHandler Me.button1.Click, AddressOf SetHeaderFooter_Click
Me.button2.Dock = System.Windows.Forms.DockStyle.Fill
Me.button2.Text = "AddTittleButton"
Me.button2.UseVisualStyleBackColor = True
AddHandler Me.button2.Click, AddressOf AddButton_Click
Me.button3.Dock = System.Windows.Forms.DockStyle.Fill
Me.button3.Text = "AddCaption"
Me.button3.UseVisualStyleBackColor = True
AddHandler Me.button3.Click, AddressOf AddCaption_Click
Me.button4.Dock = System.Windows.Forms.DockStyle.Fill
Me.button4.Text = "AddLabel"
Me.button4.UseVisualStyleBackColor = True
AddHandler Me.button4.Click, AddressOf AddLabel_Click
Me.tableLayoutPanel2.ColumnCount = 4
Me.tableLayoutPanel2.RowCount = 1
Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.0F))
Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.0F))
Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.0F))
Me.tableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.0F))
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.Controls.Add(Me.button4, 3, 0)
Me.tableLayoutPanel2.Dock = DockStyle.Fill
Me.Text = "HeaderFooter Demo"
Me.Size = New Size(800, 700)
Me.StartPosition = FormStartPosition.CenterScreen
Me.Controls.Add(Me.tableLayoutPanel1)
End Sub
Private Sub SetHeaderFooter_Click(sender As Object, e As EventArgs)
Me.SetHeaderFooterProperty()
End Sub
Private Sub AddButton_Click(sender As Object, e As EventArgs)
Me.AddTitleButton()
End Sub
Private Sub AddCaption_Click(sender As Object, e As EventArgs)
Me.AddCaption()
End Sub
Private Sub AddLabel_Click(sender As Object, e As EventArgs)
Me.AddLabel()
End Sub
Private Sub SetHeaderFooterProperty()
Me.gcCalendarGrid1.TitleHeader.BackColor = System.Drawing.Color.FromArgb(CInt(CByte(255)), CInt(CByte(128)), CInt(CByte(0)))
Me.gcCalendarGrid1.TitleHeader.Font = New System.Drawing.Font("Tahoma", 12.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CByte(0))
Me.gcCalendarGrid1.TitleHeader.ForeColor = System.Drawing.Color.RoyalBlue
Me.gcCalendarGrid1.TitleHeader.Margin = New System.Windows.Forms.Padding(5)
Me.gcCalendarGrid1.TitleHeader.Padding = New System.Windows.Forms.Padding(5)
Me.gcCalendarGrid1.TitleHeader.PatternEffect = New GrapeCity.Win.CalendarGrid.CalendarPatternEffect(GrapeCity.Win.CalendarGrid.CalendarPatternStyle.DiagonalCross, System.Drawing.Color.Bisque)
End Sub
Private Sub AddTitleButton()
Dim previousButton As New CalendarTitleButton()
previousButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.Previous
previousButton.Name = "calendarTitleButton4"
previousButton.Text = "<<"
previousButton.ToolTipText = "{0}"
Dim nextButton As New CalendarTitleButton()
nextButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.[Next]
nextButton.Name = "calendarTitleButton4"
nextButton.Text = ">>"
nextButton.ToolTipText = "{0}"
Dim gotoDateButton As New CalendarTitleButton()
gotoDateButton.BackColor = System.Drawing.Color.AliceBlue
gotoDateButton.ButtonBehavior = GrapeCity.Win.CalendarGrid.CalendarTitleButtonBehavior.GotoDate
gotoDateButton.DateFormat = "{MonthDay}"
gotoDateButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat
gotoDateButton.GotoDate = New System.DateTime(2014, 2, 14, 0, 0, 0, _
0)
gotoDateButton.Name = "calendarTitleButton5"
gotoDateButton.Text = "{0}"
gotoDateButton.ToolTipText = "{0}"
Me.gcCalendarGrid1.TitleHeader.Children.Add(previousButton)
Me.gcCalendarGrid1.TitleHeader.Children.Add(nextButton)
Me.gcCalendarGrid1.TitleHeader.Children.Add(gotoDateButton)
End Sub
Private Sub AddCaption()
Dim titleCaption As New CalendarTitleCaption()
titleCaption.DateFormat = "yyyy年M月 (ggge年)"
titleCaption.DateFormatType = GrapeCity.Win.CalendarGrid.CalendarDateFormatType.InputMan
titleCaption.Name = "calendarTitleCaption2"
titleCaption.Text = "{0}"
titleCaption.HorizontalAlignment = CalendarHorizontalAlignment.Center
Me.gcCalendarGrid1.TitleHeader.Children.Add(titleCaption)
End Sub
Private Sub AddLabel()
Dim titleLabel As New CalendarTitleLabel()
titleLabel.Name = "calendarTitleLabel1"
titleLabel.Text = "Text"
titleLabel.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
titleLabel.HorizontalAlignment = CalendarHorizontalAlignment.Right
Me.gcCalendarGrid1.TitleHeader.Children.Add(titleLabel)
End Sub
<STAThreadAttribute> _
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New NavigationBarDemo())
End Sub
End Class
End Namespace