GrapeCity CalendarGrid for Windows Forms 2.0J
Locked プロパティ
使用例 

セルがロックされているかどうかを示す値を取得または設定します。
構文
Public Property Locked As Boolean
public bool Locked {get; set;}

プロパティ値

セルがロックされている場合は true。それ以外の場合は false
解説
このプロパティが設定されていない場合は、CalendarTemplate 内の関連するセルから値が継承されます。GcCalendarGrid.Protectedtrue の場合、そのカレンダーグリッド内のロックされているセルはすべて編集できません。
使用例
次のサンプルコードは、LockedGcCalendarGrid.Protected の使用方法を示します。
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
参照

CalendarCell クラス
CalendarCell メンバ
Protected プロパティ

 

 


c 2008 GrapeCity inc. All rights reserved.