Silk Webware Home Our Products Contact Us Development Services
IMAGE CANVAS
Details
VB.Net Examples
C# Examples
Toolbox Setup
Download Control
Purchase Control


Recent Award 
Download all of our Webcontrols

Download all of our Webcontrols. Fully functional trial versions. Includes simple setup instructions and demo code.


 



Smartphone Software 

© SilkWebware 2010 




  On-The-Fly Image Generation Example
 

The following example assumes you have added Image Canvas to the Visual Studio Toolbox. (See Setup Section.) It also assumes that you have a new or existing webform (aspx page) in your project.

1. Drag and Drop Image Canvas onto the webform design surface.
2. Open the web forms code view. (code behind page).
3. In the Page Load method add the code as found below.
4. Optional. After you have set up this example you may wish to experiment with the ImageOuputFormat and ScaleSize properties (in design view right click Image Canvas and select properties). Try setting the ImageOuputFormat to PNG. Png is a high quality and lossless format and supported by all major web browsers. Please note that the GIF format is not presently supported.
Note: An Image Canvas Solution requires that session state is available.
 

Dim strTestMessage As String
Dim image As New Bitmap(300, 60) ' create a new bitmap image.

Dim g As Graphics ' graphics context to draw to
Dim font As New Font("Arial", 16, FontStyle.Bold) ' font for the string
strTestMessage = DateTime.Now.Millisecond.ToString() & " -- This is a Test "
g = Graphics.FromImage(image)
g.Clear(Color.Aqua)
g.DrawString(strTestMessage, font, SystemBrushes.WindowText, 10, 10)
ImageCanvas1.Image = image 'the default output format is JPEG 'the image will now be drawn to the webpage