RectangularSelectionToolWithCopyPaste Class
Visual tool for selecting a rectangular image region in image viewer. Selected image region can be copied into clipboard. Selected image region can be replaced by image from clipboard.
RectangularSelectionToolWithCopyPaste allows to:
- Select a rectangular region of image
- Copy selected region of image to clipboard or get selected region as a Bitmap object
- Paste image from clipboard into selected region of image
Rectangular region of image in image viewer can be selected as follows:
- place the mouse to the desired position
- press the action button (ActionButton) and select the region by holding the action button
- release the action button to stop the selection of region
Selected region of image can be copied to clipboard by pressing Ctrl+C button.
Selected region of image can be replaced by image from clipboard by pressing Ctrl+V button.
Rectangular region of image in image viewer can be programmatically selected with
System.Drawing.Rectangle property.
Selected region of image can be programmatically copied to clipboard using
CopyToClipboard.
Selected region of image can be programmatically replaced by image from clipboard using
PasteFromClipboard.
Rectangular region of image in image viewer can be programmatically selected with
System.Drawing.Rectangle property.
If
ActionButton is set to right mouse button, context menu during action can be disabled with the
DisableContextMenu property.
This C#/VB.NET code shows how to programmatically copy part of image to clipboard.
Class SelectionExample
' Programmatically copy part of image to clipboard.
Public Sub RunExample(viewer As Vintasoft.Imaging.UI.ImageViewer)
' create an instance of the RectangularSelectionToolWithCopyPaste class
Dim selection As New Vintasoft.Imaging.UI.VisualTools.RectangularSelectionToolWithCopyPaste()
' set the tool as the current tool of the ImageViewer
viewer.VisualTool = selection
' set the region of interest on image
selection.Rectangle = New System.Drawing.Rectangle(50, 50, 250, 150)
' copy selected region of image to clipboard
selection.CopyToClipboard()
End Sub
End Class
class SelectionExample
{
// Programmatically copy part of image to clipboard.
public void RunExample(Vintasoft.Imaging.UI.ImageViewer viewer)
{
// create an instance of the RectangularSelectionToolWithCopyPaste class
Vintasoft.Imaging.UI.VisualTools.RectangularSelectionToolWithCopyPaste selection =
new Vintasoft.Imaging.UI.VisualTools.RectangularSelectionToolWithCopyPaste();
// set the tool as the current tool of the ImageViewer
viewer.VisualTool = selection;
// set the region of interest on image
selection.Rectangle = new System.Drawing.Rectangle(50, 50, 250, 150);
// copy selected region of image to clipboard
selection.CopyToClipboard();
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5