You are here: GdPicture.NET > Using GdPicture.NET
logo.gif
ContentsIndexHome
PreviousUpNext
Using GdPicture.NET

1. Installation 

 

On development computer you need to install the complete GdPicture.NET package running the gdpicturedotnet.exe installer. 

The GdPicture.NET suite should be installed into C:\Program Files\GdPicture.NET\ 

After installation, we recommend you to have a look on the samples directory to get some featured examples of the GdPicture.NET usage. 

 

The GdPicture.NET suite includes 2 classes: GdPictureImaging & GdViewer. See below how to instantiate objects from these classes. 

 

Notes:

  • To install the GdPicture.NET suite on client computers, please see the "Redistributing GdPicture.NET" section.
  • GdPicture.NET requires the .NET Framework 2.0 or higher.
 

 

2. Adding a reference to GdPicture.NET into your application. 

  • Start Visual Studio .NET
  • Begin a new project using your favorite programming language.
  • Select Project / Add Reference...
  • Select the Browse tab and select the GdPicture.NET dll library which can be found on C:\Program Files\GdPicture.NET\Redist\Framework X.X\GdPicture.NET.dll
  • Add a link to the GdPicture namespace where you want to use the DLL
    • In C#, add the appropriate using directive to the code file(s) where you want to use the DLL: using GdPicture;
    • In VB.NET, add the appropriate Imports directive to the code file(s) where you want to use the DLL: Imports GdPicture
 

 

3. Using a GdPictureImaging object into your application. 

 

Before starting, make sure you successfully done first & second steps. 

The GdPictureImaging class is a non-visual class. Therefore you have to instantiate a GdPictureImaging object by code. 

Each GdPictureImaging object must be unlocked using the SetLicenseNumber() method. 

  • C# example:
 

private void button1_Click(object sender, EventArgs e) 

{ 

GdPictureImaging oGdPictureImaging = new GdPictureImaging(); 

oGdPictureImaging.SetLicenseNumber("YOUR_LICENSE_KEY"); 

int ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("c:\\test.jpg"); 

oGdPictureImaging.SaveAsJP2(ImageID, "c:\\test.jp2",64); 

oGdPictureImaging.ReleaseGdPictureImage(ImageID); 

} 

  • VB.NET example:
 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 

Dim oGdPictureImaging As New GdPictureImaging 

 

oGdPictureImaging.SetLicenseNumber("YOUR_LICENSE_KEY") 

Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\test.jpg") 

oGdPictureImaging.SaveAsJP2(ImageID, "c:\test.jp2", 64) 

oGdPictureImaging.ReleaseGdPictureImage(ImageID) 

End Sub 

 

 

4. Using a GdViewer object into your application. 

 

Before starting, make sure you successfully done first & second steps. 

The GdViewer class is a visual class. Therefore you can instantiate a GdViewer object by code or simply dragging a GdViewer item from the Visual Studio Toolbox to your Windows Form: 

  • Right-click into the Toolbox Items and select "Add/Remove Items" for visual studio 2003 or "Choose Items" for Visual Studio 2005 and Visual Studio 2008.
  • Select the .NET Framework Components tab
  • Click on the Brows... button
  • Select the GdPicture.NET dll which can be found on C:\Program Files\GdPicture.NET\Redist\Framework X.X\GdPicture.NET.dll
  • Now you will be able to select a GdViewer Item from the Toolbox in order to draw it within your forms.
 

Each GdViewer object must be unlocked using the SetLicenseNumber() method. 

  • C# example:
 

private void button1_Click(object sender, EventArgs e) 

{ 

this.gdViewer1.SetLicenseNumber("YOUR_LICENSE_KEY"); 

this.gdViewer1.DisplayFromFile("c:\\test.jpg"); 

} 

  • VB.NET example:
 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 

Me.GdViewer1.SetLicenseNumber("YOUR_LICENSE_KEY") 

Me.GdViewer1.DisplayFromFile("c:\test.jpg") 

End Sub 

 

 

5. Displaying a GdPicture Image handled by a GdPictureImaging object to a GdViewer object. 

 

The GdPictureImaging class can create GdPicture Image from file, memory RAW, scanner... 

If you want to display in real time a GdPicture Image handled by a GdPictureImaging object you can use the DisplayFromGdPictureImage method of the GdViewer class. 

 

VB.NET example

 

This example assumes you already have a GdPictureImaging object named oGdPictureImaging and a GdViewer object drawn on your form named GdViewer1. 

 

Dim ImageID As Integer = oGdPictureImaging.CreateImageFromFile("c:\test.jpg") 

GdViewer1.DisplayFromGdPictureImage(ImageID) 

 

If later in your code, you want to draw something on the image (like text) and display the modification without reloading the image you can do: 

 

oGdPictureImaging.DrawText(ImageID, "hello World!", 50, 50, 10, FontStyle.FontStyleBold, Color.Red, "Arial", True) 

GdViewer1.Refresh()  

What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.