Complete the steps below to learn how to load and configure an image in the BinaryImage control.
The following steps are for an application created on Visual Studio 2012. The steps may be differ slightly based on the version of Visual Studio you use.
Set the location of the image to be displayed into the BinaryImage control, if there is no binary image data available. To know how to add an image using binary image data. These steps assume that the image to be loaded is included in the project as an embedded resource.
Set the ImageUrl property in the <cc1:C1BinaryImage>
tag to add an image to the BinaryImage control.
<cc1:C1BinaryImage ID="C1BinaryImage1" runat="server" ImageUrl="~/C1.png" />
Add the following code to the Page_Load event, to add an image to the BinaryImage control:
To write code in C#
C# |
Copy Code
|
---|---|
C1BinaryImage1.ImageUrl = "C1.png"; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1BinaryImage1.ImageUrl = "C1.png" |
Run the project and notice that the image appears in its original size.
Set the Height, Width and ResizeMode in the <cc1:C1BinaryImage>
tag to configure the image in the BinaryImage control.
<cc1:C1BinaryImage ID="C1BinaryImage1" runat="server" ImageUrl="~/C1.png" Height="300px" ResizeMode="Fit" Width="400px" />
Add the following code to the Page_Load event, to configure the BinaryImage control:
To write code in C#
C# |
Copy Code
|
---|---|
C1BinaryImage1.Height = 300; C1BinaryImage1.Width = 400; C1BinaryImage1.ResizeMode = C1.Web.Wijmo.Controls.C1BinaryImage.ImageResizeMode.Fit; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1BinaryImage1.Height = 300 C1BinaryImage1.Width = 400 C1BinaryImage1.ResizeMode = C1.Web.Wijmo.Controls.C1BinaryImage.ImageResizeMode.Fit |
When you run the project, notice that the image is resized to the desired Height and Width and fits the web page.