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

セルの値が false の場合に基になるデータソースに保存される値を取得または設定します。
構文
public object FalseValue {get; set;}
Public Property FalseValue As Object
 

プロパティ値

セルの値が false の場合に基になるデータソースに保存される値を表す System.Object 値。既定値は null 参照 (Visual Basicでは Nothing) です。
解説
このプロパティの値が null 参照 (Visual Basicでは Nothing) 以外に設定されている場合に、ユーザーインタフェース操作(マウスのクリックまたはキーの押し下げ)または SetFormattedValue メソッドによってセルの値が false または System.Windows.Forms.CheckState.Unchecked に変更されると、このプロパティの値が基になるデータストレージに保存されます。逆に、データストレージ内の基になる値がこのプロパティの値と同じである場合、CalendarCheckBoxCellType はオフの状態で表示されます。
使用例
次のサンプルコードは、CalendarCheckBoxCellType のプロパティを示します。ここでは、ThreeStatetrue に設定し、各状態の格納値を TrueValueFalseValue、および IndeterminateValue によって設定しています。さらに、Text プロパティと CheckAlign プロパティを変更しています。
using System;
using System.Windows.Forms;
using System.Drawing;
using GrapeCity.Win.CalendarGrid;

namespace CalendarGridSampleCode
{
    public class CheckBoxCellDemo : Form
    {
        private GcCalendarGrid gcCalendarGrid1 = new GcCalendarGrid();
        private Label label = new Label();

        public CheckBoxCellDemo()
        {
            this.gcCalendarGrid1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcCalendarGrid1);
            this.Load += Form1_Load;
            this.gcCalendarGrid1.CellValueChanged += gcCalendarGrid1_CellValueChanged;

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 30;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "Click one CheckBoxCell to change the check state, then press ENTER key to commit value.";
            this.Controls.Add(label);
            this.Text = "CheckBoxCell Demo";
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CalendarCheckBoxCellType checkBoxCell1 = new CalendarCheckBoxCellType();
            checkBoxCell1.ThreeState = true;
            checkBoxCell1.TrueValue = "Yes";
            checkBoxCell1.FalseValue = "No";
            checkBoxCell1.IndeterminateValue = "Ignore";
            checkBoxCell1.Text = "State";
            checkBoxCell1.CheckAlign = ContentAlignment.MiddleRight;

            CalendarTemplate template1 = CalendarTemplate.CreateDefaultTemplate();
            template1.Content[1, 0].CellType = checkBoxCell1;
            template1.Content[2, 0].CellType = checkBoxCell1.Clone();

            gcCalendarGrid1.Template = template1;
        }

        void gcCalendarGrid1_CellValueChanged(object sender, CalendarCellEventArgs e)
        {
            //When the value commit, the actual stored value is TrueValue, FalseValue or IndeterminateValue.
            object currentCellValue = this.gcCalendarGrid1[gcCalendarGrid1.CurrentCellPosition.Date][gcCalendarGrid1.CurrentCellPosition.RowIndex, gcCalendarGrid1.CurrentCellPosition.ColumnIndex].Value;
            if (currentCellValue != null)
            {
                this.label.Text = "The current parsed value is " + currentCellValue.ToString();
            }
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new CheckBoxCellDemo());
        }
    }
}
Imports System.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.CalendarGrid

Namespace CalendarGridSampleCode
    Public Class CheckBoxCellDemo
        Inherits Form
        Private gcCalendarGrid1 As New GcCalendarGrid()
        Private label As New Label()

        Public Sub New()
            Me.gcCalendarGrid1.Dock = DockStyle.Fill
            Me.Controls.Add(Me.gcCalendarGrid1)
            AddHandler Me.Load, AddressOf Form1_Load
            AddHandler Me.gcCalendarGrid1.CellValueChanged, AddressOf gcCalendarGrid1_CellValueChanged

            Me.label.Dock = DockStyle.Bottom
            Me.label.Height = 30
            Me.label.BackColor = SystemColors.Info
            Me.label.Text = "Click one CheckBoxCell to change the check state, then press ENTER key to commit value."
            Me.Controls.Add(label)
            Me.Text = "CheckBoxCell Demo"
        End Sub

        Private Sub Form1_Load(sender As Object, e As EventArgs)
            Dim checkBoxCell1 As New CalendarCheckBoxCellType()
            checkBoxCell1.ThreeState = True
            checkBoxCell1.TrueValue = "Yes"
            checkBoxCell1.FalseValue = "No"
            checkBoxCell1.IndeterminateValue = "Ignore"
            checkBoxCell1.Text = "State"
            checkBoxCell1.CheckAlign = ContentAlignment.MiddleRight

            Dim template1 As CalendarTemplate = CalendarTemplate.CreateDefaultTemplate()
            template1.Content(1, 0).CellType = checkBoxCell1
            template1.Content(2, 0).CellType = checkBoxCell1.Clone()

            gcCalendarGrid1.Template = template1
        End Sub

        Private Sub gcCalendarGrid1_CellValueChanged(sender As Object, e As CalendarCellEventArgs)
            'When the value commit, the actual stored value is TrueValue, FalseValue or IndeterminateValue.
            Dim currentCellValue As Object = Me.gcCalendarGrid1(gcCalendarGrid1.CurrentCellPosition.[Date])(gcCalendarGrid1.CurrentCellPosition.RowIndex, gcCalendarGrid1.CurrentCellPosition.ColumnIndex).Value
            If currentCellValue IsNot Nothing Then
                Me.label.Text = "The current parsed value is " + currentCellValue.ToString()
            End If
        End Sub

        <STAThreadAttribute> _
        Public Shared Sub Main()
            Application.EnableVisualStyles()
            Application.Run(New CheckBoxCellDemo())
        End Sub
    End Class
End Namespace
参照

CalendarCheckBoxCellType クラス
CalendarCheckBoxCellType メンバ

 

 


c 2008 GrapeCity inc. All rights reserved.