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 LockDemo : Form
{
private GcCalendarGrid gcCalendarGrid1;
private CheckBox checkBox;
public LockDemo()
{
this.Text = "Lock Demo";
this.Size = new Size(800, 700);
this.StartPosition = FormStartPosition.CenterScreen;
gcCalendarGrid1 = new GcCalendarGrid();
gcCalendarGrid1.Dock = DockStyle.Fill;
gcCalendarGrid1.Template.Content[1, 0].Locked = false;
gcCalendarGrid1.Template.Content[1, 0].Value = "Unlocked";
gcCalendarGrid1.Template.Content[2, 0].Locked = true;
gcCalendarGrid1.Template.Content[2, 0].Value = "Locked";
gcCalendarGrid1.Protected = true;
this.Controls.Add(gcCalendarGrid1);
checkBox = new CheckBox();
checkBox.Text = "Protected";
checkBox.Checked = gcCalendarGrid1.Protected;
checkBox.CheckedChanged += checkBox_CheckedChanged;
checkBox.Dock = DockStyle.Bottom;
this.Controls.Add(checkBox);
}
void checkBox_CheckedChanged(object sender, EventArgs e)
{
this.gcCalendarGrid1.Protected = checkBox.Checked;
}
[STAThreadAttribute]
public static void Main()
{
Application.EnableVisualStyles();
Application.Run(new LockDemo());
}
}
}
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 LockDemo
Inherits Form
Private gcCalendarGrid1 As GcCalendarGrid
Private checkBox As CheckBox
Public Sub New()
Me.Text = "Lock Demo"
Me.Size = New Size(800, 700)
Me.StartPosition = FormStartPosition.CenterScreen
gcCalendarGrid1 = New GcCalendarGrid()
gcCalendarGrid1.Dock = DockStyle.Fill
gcCalendarGrid1.Template.Content(1, 0).Locked = False
gcCalendarGrid1.Template.Content(1, 0).Value = "Unlocked"
gcCalendarGrid1.Template.Content(2, 0).Locked = True
gcCalendarGrid1.Template.Content(2, 0).Value = "Locked"
gcCalendarGrid1.[Protected] = True
Me.Controls.Add(gcCalendarGrid1)
checkBox = New CheckBox()
checkBox.Text = "Protected"
checkBox.Checked = gcCalendarGrid1.[Protected]
AddHandler checkBox.CheckedChanged, AddressOf checkBox_CheckedChanged
checkBox.Dock = DockStyle.Bottom
Me.Controls.Add(checkBox)
End Sub
Private Sub checkBox_CheckedChanged(sender As Object, e As EventArgs)
Me.gcCalendarGrid1.[Protected] = checkBox.Checked
End Sub
<STAThreadAttribute> _
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New LockDemo())
End Sub
End Class
End Namespace