imageComponent.NET title a curve
   Home Page | Blog | Online Forum | Links | SiteMap
Skip Navigation Links.
- Recommended .NET Book -

Developing Microsoft .NET Controls with Microsoft Visual Basic .NET

From Book News, Inc. Written for experienced developers, this guide explains how to work wit...[more]
Skip Navigation LinksHome > Products > CoolWatermark > Sample Code

After you download CoolWatermark, you could double click the install.bat to execute the installation. That will copy the core file IC.CoolWatermark.dll ( angGoGo.CoolWatermark.dll for v1.x ) to your computer Global Assembly Cache Folder. It could be "C:\WINDOWS\assembly". When you want to use this assembly, add the reference of CoolWatermark in your project and include the namespace like below:

Working with CoolWatermark v2.x

In version 2.x, the namespace has been changed to "IC.CoolWatermark" instead of the previous "angGoGo.CoolWatermark". So you must include the correct namespace as follows when using the new version.

[VB.NET]

 

Imports IC.CoolWatermark

 

[C#]

 

using IC.CoolWatermark;

 


Delcare the instance of CoolWatermark as follows

[VB.NET]

 

Dim objcw As IC.CoolWatermark.Writer

objcw = New IC.CoolWatermark.Writer

 

[C#]

 

IC.CoolWatermark.Writer objcw = new Writer();


For more sample code about how to use other methods in CoolWatermark v2.0, such as Filter, please read [Tutorial] section in the documentation.

Working with CoolWatermark v1.x

[VB.net]

Imports angGoGo.CoolWatermark

[C#]

using angGoGo.CoolWatermark;

You can initialize the object like below.

[VB.net]

Dim image As Image
Dim bitmap As New Bitmap (320,120)
image = bitmap
Dim objWriter As New angGoGo.CoolWatermark.Writer( image )

[C#]

Image image;
Bitmap bitmap = new Bitmap(320,120);
image = (Image)bitmap;
angGoGo.CoolWatermark.Writer objWriter = new Writer(image);

Assign some properties, such as colors, effect style, position. For example, the following code perform setup a position by using PositionStyle

[VB.net]

'Sets the position in the middel center of image by PositionStyle
objWriter.PositionStyle = PositionStyle.MiddleCenter

[C#]

// Sets the position in the middel center of image by PositionStyle
objWriter.PositionStyle = PositionStyle.MiddleCenter;

Write the text on the image.

[VB.net]

image = objWriter.WriteText("Test watermark text")

[C#.net]

image = objWriter.WriteText("Test watermark text");

WriteText method returns an Image object , but you also can get the Image property like the following code.

[VB.net]

objWriter.WriteText("Test watermark text")
image = objWriter.Image

[C#]

objWriter.WriteText("Test watermark text");
image = objWriter.Image



  Quick Search
Components
Books



Sponsors

  Home | Links | Blog | SiteMap | About | 2005-2007 © imageComponent.NET, All Rights Reserved.