Spread Windows Forms 10.0 Product Documentation
TextAlign Property (FpCheckBox)
Example 


Gets or sets the alignment of the text relative to the picture in the check box control.
Syntax
'Declaration
 
Public Overridable Property TextAlign As ButtonTextAlign
'Usage
 
Dim instance As FpCheckBox
Dim value As ButtonTextAlign
 
instance.TextAlign = value
 
value = instance.TextAlign
public virtual ButtonTextAlign TextAlign {get; set;}

Property Value

ButtonTextAlign setting that determines the alignment of the text in the button
Remarks

This property uses the TextAlign enumerations.

Specify the check box pictures for the states using the Picture property. Specify the text using the Caption property, or if you want to provide text for each state, the TextIndeterminate, TextFalse, and TextTrue properties.

Specify the alignment of the contents (text and check box picture) by setting the PictureAlignH and PictureAlignV properties.

Example
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 
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

FpCheckBox Class
FpCheckBox Members
TextAlign Enumeration
Caption Property
TextIndeterminate Property
TextFalse Property
TextTrue Property
PictureAlignH Property
PictureAlignV Property

 

 


Copyright © GrapeCity, inc. All rights reserved.