Spread Windows Forms 13.0 Product Documentation
FarPoint.Win Assembly / FarPoint.Win Namespace / FpCheckBox Class / PictureAlignH Property
Example


In This Topic
    PictureAlignH Property
    In This Topic
    Gets or sets the horizontal alignment of the check box picture in the control.
    Syntax
    'Declaration
     
    Public Overridable Property PictureAlignH As HorizontalAlignment
    'Usage
     
    Dim instance As FpCheckBox
    Dim value As HorizontalAlignment
     
    instance.PictureAlignH = value
     
    value = instance.PictureAlignH
    public virtual HorizontalAlignment PictureAlignH {get; set;}

    Property Value

    HorizontalAlignment setting that determines the alignment
    Remarks

    Use this property to specify the horizontal alignment for the check box picture and text. Use the PictureAlignV property to specify the vertical alignment for the check box picture and text.

    Set the pictures to display for the check box states using the Picture property.

    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 
    See Also