This example copies a portion of the image displayed in ImageKit control using the CutRectImage method.

Example Code

Use the mouse to specify the area on the image that you want to copy. The copied image is set in the ImageKit.Image property and displayed

[Visual Basic.NET]

'(Images are already loaded in the ImageKit control)
'Disable annotation mode so that you can select an area on the image by dragging the mouse
ImageKit1.Edit.EditEnabled = False

'After selecting the area to be copied, execute the CutRectImage method)
'Set the selected area into the Effect.Rect property
ImageKit1.Effect.Rect = ImageKit1.Rect

'Execute the CutRectImage method
Dim ret As Boolean = ImageKit1.Effect.CutRectImage()
If Not ret Then Return

'Refresh ImageKit control to display the copied image
ImageKit1.Refresh()

[Visual C#.NET]

//(Images are already loaded in the ImageKit control)
//Disable annotation mode so that you can select an area on the image by dragging the mouse
ImageKit1.Edit.EditEnabled = false;

//After selecting the area to be copied, execute the CutRectImage method)
//Set the selected area into the Effect.Rect property
ImageKit1.Effect.Rect = ImageKit1.Rect;

//Execute the CutRectImage method
bool ret = ImageKit1.Effect.CutRectImage()
if (!ret) return;

//Refresh ImageKit control to display the copied image
ImageKit1.Refresh();

Relevant Properties

ImageKit.Rect
ImageKit.Edit.EditEnabled
ImageKit.Effect.Rect
ImageKit.Image

Relevant Methods

ImageKit.Effect.CutRectImage

The ImageKit WPF is created by Newtone Corporation