This documentation is for the old version. Go to the latest Graphics Mill docs

Quick Start in Web Forms

This topic describes how to get started with Graphics Mill for .NET when creating an ASP.NET application. It provides step-by-step instructions how to create a simple Web Forms application which loads an image and displays it.

  1. Create new Web site in the Visual Studio 2005 (menu File -> New -> Web Site).
  2. Add the BitmapViewer control to the toolbox:
    • Right click the component toolbox and select Choose Items.
    • Find the BitmapViewer component in the .NET Framework Components tab. If you cannot find this component for some reason, click the Browse button and find the Aurigma.GraphicsMill.WebControls.dll assembly. It should be looking as follows:

      Visual Studio Choose Toolbox Items dialog

  3. Find BitmapViewer iconBitmapViewer item at the toolbox and drag it at the form. As a result, the form should be looking similar to this screenshot:

    Visual Studio Form Designer

  4. Create a folder named Photos and put some photo there. In our case it is the Sample.jpg file.
  5. Click anywhere on the form in order to generate a handler for the Load event of the Page object and add the code which will load the sample photo:
    Visual Basic
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    	BitmapViewer1.Bitmap.Load(Server.MapPath("Photos/Sample.jpg"))
    End Sub
    C#
    private void Page_Load(object sender, System.EventArgs e)
    {
    	BitmapViewer1.Bitmap.Load(Server.MapPath("Photos/Sample.jpg"));
    }
  6. Toggle to the Source mode and change the doctype of the page from XHTML 1.0 Transitional:
    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    to HTML 4.0 Transitional:
    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
    
    Also, remove XHTML namespace declaration from the <html> tag, i.e. replace this:
    HTML
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    by this one:
    HTML
    <html>
    
    Remark

    This step is necessary as a workaround of a problem with scrollbars which occurs in Internet Explorer 6. This problem is caused by a bug in Internet Explorer which misbehaves with certain XHTML code. It does not occur on other browsers such as Firefox, Mozilla, Safari, and Opera.

  7. Run the application (menu Debug -> Start Without Debugging or Ctrl+F5 shortcut).

After you run the application and load some image, it will be looking like this screenshot:

Sample application.