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

Quick Start in Windows Forms

This topic describes how to get started with Graphics Mill for .NET when creating the Windows application. We will create a simple Windows Forms application which loads the image and displays it.

Follow these steps:

  1. Create new Windows Forms application in Visual Studio (menu File -> New -> Project).
  2. Add the BitmapViewer control to the toolbox:
    • Right click the component toolbox and select Choose Items.
    • Find the BitmapViewer component at the .NET Framework Components tab. If for some reason you cannot find this component, click the Browse button and find the assembly Aurigma.GraphicsMill.WinControls.dll. It should be looking as at this screenshot:
      Visual Studio Choose Toolbox Items dialog
  3. Edit the form:
    • Find BitmapViewer iconBitmapViewer item at the toolbox and drag it at the form.
    • Drag the standard OpenFileDialog control at the form.
    • Add a button at the form and add this code at the click event handler:
      Visual Basic
      Private Sub ButtonLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoad.Click
      	OpenFileDialog1.Filter = Aurigma.GraphicsMill.Codecs.FormatManager.FilterStringForLoad()
      	If OpenFileDialog1.ShowDialog = DialogResult.OK Then
      		BitmapViewer1.Bitmap.Load(OpenFileDialog1.FileName)
      	End If
      End Sub
      C#
      private void button1_Click(object sender, System.EventArgs e)
      {
      	openFileDialog1.Filter = Aurigma.GraphicsMill.Codecs.FormatManager.FilterStringForLoad;
      	if (openFileDialog1.ShowDialog() == DialogResult.OK)
      	{
      		bitmapViewer1.Bitmap.Load(openFileDialog1.FileName);
      	}
      }

    As a result, the form should be looking like this screenshot:

    Visual Studio Form Designer.

  4. 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.