PowerTools SPREAD for Windows Forms 8.0J
Checked プロパティ (FpCheckBox)


チェックボックスがONかどうかを表す値を取得または設定します。
構文
'Declaration
 
Public Overridable Property Checked As Boolean
'使用法
 
Dim instance As FpCheckBox
Dim value As Boolean
 
instance.Checked = value
 
value = instance.Checked
public virtual bool Checked {get; set;}

プロパティ値

チェックボックスがONの場合はTrue、それ以外の場合はFalse
解説

このプロパティをTrueに設定すると、チェックボックスを選択した場合、またはCheckStateプロパティをCheckedに設定した場合と同じ結果になります。

チェックボックスをONからOFFに変更すると、CheckChangedイベントが発生します。

このプロパティが使用できるのは実行時のみです。

private void Form1_Load(object sender, System.EventArgs e)
{
     control.CheckState = CheckState.Unchecked;
     control.PictureAlignH=FarPoint.Win.HorizontalAlignment.Center;
     control.PictureAlignV = FarPoint.Win.VerticalAlignment.Center;
     control.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile("d:\\mail16a.ico", true), FarPoint.Win.RenderStyle.Normal);
}
private void control_CheckChanged(object sender, System.EventArgs e)
    {
    if (control.CheckState == CheckState.Checked)
    { 
        control.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile("d:\\mail16a.ico", true), FarPoint.Win.RenderStyle.Normal);
        control.PictureAlignH = FarPoint.Win.HorizontalAlignment.Center;
        control.PictureAlignV = FarPoint.Win.VerticalAlignment.Center;
        control.TextTrue = "Mail's been checked";
    }
   else if (control.CheckState == CheckState.Unchecked) 
   {
        control.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile("d:\\mail16b.ico", true), FarPoint.Win.RenderStyle.Normal);
        control.PictureAlignH = FarPoint.Win.HorizontalAlignment.Center;
        control.PictureAlignV = FarPoint.Win.VerticalAlignment.Center;
        control.TextFalse = "Mail needs to be checked";
    }
    else
    {
        control.CheckState = CheckState.Indeterminate;
        control.TextIndeterminate = "No mail today";
    }
} 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     control.Checked = False
     control.BackgroundImage = New FarPoint.Win.Picture(Image.FromFile("d:\\mail16a.ico", True), FarPoint.Win.RenderStyle.Normal)
End Sub

Private Sub control_CheckChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles control.CheckChanged
     If control.CheckState = CheckState.Checked Then
          control.BackgroundImage = New FarPoint.Win.Picture(Image.FromFile("d:\\mail16a.ico", True), FarPoint.Win.RenderStyle.Normal)
          control.PictureAlignH = FarPoint.Win.HorizontalAlignment.Center
          control.PictureAlignV = FarPoint.Win.VerticalAlignment.Center
          control.TextTrue = "Mail's been checked"
     ElseIf control.CheckState = CheckState.Unchecked Then
          control.BackgroundImage = New FarPoint.Win.Picture(Image.FromFile("d:\\mail16b.ico", True), FarPoint.Win.RenderStyle.Normal)
          control.PictureAlignH = FarPoint.Win.HorizontalAlignment.Center
          control.PictureAlignV = FarPoint.Win.VerticalAlignment.Center
          control.TextFalse = "Mail needs to be checked"
     Else
          control.CheckState = CheckState.Indeterminate
          control.TextIndeterminate = "No mail today"
     End If
 End Sub 
参照

FpCheckBox クラス
FpCheckBox メンバ
CheckState プロパティ
CheckChanged イベント

 

 


© 2004-2015, GrapeCity inc. All rights reserved.