ComponentOne BinaryImage for ASP.NET Web Forms
Explore Features / Image Settings / Resize Modes
In This Topic
    Resize Modes
    In This Topic

    The ResizeMode property determines whether the BinaryImage should be resized automatically if the Height and Width are set in pixels. BinaryImage supports three Resize Modes:

    This topic demonstrates how to change resize modes and how they appear in the output.

    In the Designer

    1. Select the BinaryImage control and click the smart tag   to open the BinaryImage Tasks Menu.
    2. Set the Height to 100px and Width to 100px.
    3. Set the ResizeMode to Fit.

    In Source View

    Set the Height, Width and ReziseMode in the <cc1:C1BinaryImage> tag to resize the BinaryImage control.

    <cc1:C1BinaryImage ID="C1BinaryImage1" runat="server" ImageUrl="~/Koala.png" Height="100px" ResizeMode="Fit" Width="100px" />

    In Code

    Add the following code to the Page_Load event, to resize to the BinaryImage control:

    To write code in C#

    C#
    Copy Code
    C1BinaryImage1.Height = 100;
    C1BinaryImage1.Width = 100;
    C1BinaryImage1.ResizeMode = C1.Web.Wijmo.Controls.C1BinaryImage.ImageResizeMode.Fit;

    To write code in Visual Basic

    Visual Basic
    Copy Code
    C1BinaryImage1.Height = 100
    C1BinaryImage1.Width = 100
    C1BinaryImage1.ResizeMode = C1.Web.Wijmo.Controls.C1BinaryImage.ImageResizeMode.Fit

    What You've Accomplished

    When you run the project, notice that the image has been resized according to the Resize Mode.

    Original Image:

    The following image shows how the image appears in Fit mode:

    The following image shows how the image appears in Fill mode:


    The following image shows how the image appears in Crop mode: