PowerTools CalendarGrid for Windows Forms 1.0J
Protected プロパティ
使用例 

GcCalendarGrid コントロールを編集不可にするかどうかを示す値を取得または設定します。
構文
Public Property Protected As Boolean
public bool Protected {get; set;}

プロパティ値

GcCalendarGrid コントロールを編集不可にする場合は true。それ以外の場合は false。既定値は false です。
解説
Protectedtrue で、ある特定の CalendarCellLocked プロパティが true の場合、そのセルは編集できません。それ以外の場合、セルは編集できます。
使用例
次のサンプルコードは、LockedProtected の使用方法を示します。
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
参照

GcCalendarGrid クラス
GcCalendarGrid メンバ
CalendarCell クラス
CalendarCell.Locked

 

 


© 2014 GrapeCity inc. All rights reserved.