ComponentOne Sizer for WinForms
In This Topic
    Display Image
    In This Topic

    You can use images as background in Sizer and change their alignment and scaling to suit your requirements. Setting background image enhances the overall look of the application and makes it more engaging for the users.

    Let us explore how you can display an image as background in Sizer control.

    Display image in C1Sizer

    To display an image in Sizer control, you can use Image property of the C1Sizer class and specify the file path of the image to be added to the control. This file path refers to the source directory of the application where the image is located.

    The following code snippet shows how to display an image in Sizer.

    C#
    Copy Code
    c1Sizer1.Image = Image.FromFile("../.../image.png");
    

    Back to Top 

    Image Alignment

    By default, the image is aligned at the center of the control. However, you can easily change its  alignment by using ImageAlignment property of the C1Sizer class. The ImageAlignment property accepts the value from ImageAlignment enumeration to set the image alignment with respect to the Sizer control.

    The following code snippet shows how to change the alignment of an image in Sizer.

    C#
    Copy Code
    c1Sizer1.ImageAlignment = C1.Framework.ImageAlignment.LeftTop;
    

    Back to Top 

    Image Scaling

    With Sizer, you can easily scale an image up or down by resizing it without affecting the quality. The C1Sizer class provides ImageScaling property which accepts value from the ImageScaling enumeration to set the scaling of the displayed image to one the following values:

    The following code shows how to set image scaling in Sizer.

    C#
    Copy Code
    //set image scaling 
    c1Sizer1.ImageScaling = C1.Framework.ImageScaling.Tile;
    

    Back to Top