Sets the mouse cursors associated with an interactive mode
public void SetInteractiveModeCursor(
RasterViewerInteractiveMode interactiveMode,
Cursor idleCursor,
Cursor workingCursor
)
public:
void SetInteractiveModeCursor(
RasterViewerInteractiveMode interactiveMode,
Cursor^ idleCursor,
Cursor^ workingCursor
)
public:
void SetInteractiveModeCursor(
RasterViewerInteractiveMode^ interactiveMode,
Cursor^ idleCursor,
Cursor^ workingCursor
)
interactiveMode
A RasterViewerInteractiveMode enumeration member that specifies the interactive mode to set the mouse cursors for.
idleCursor
A Cursor that defines the mouse cursor to use when the interactive mode is idle.
workingCursor
A Cursor that defines the mouse cursor to use when the interactive mode is working.
Use this method to set different mouse cursors for each interactive mode used in this RasterImageViewer. A value of null (Nothing in VB) for any of the cursors instructs the viewer to use the default cursor set in the Cursor property either by the designer or through code.
By default, all the interactive modes have a cursor value of null (Nothing in VB) and changing the interactive mode will not change the mouse cursor unless you call this method first to set the desired cursors to use.
The idle cursor is used when the interactive mode is not working, in other words, when the user has set the interactive mode to a value but has not clicked the mouse button to initiate it yet. The working cursor is used when the interactive mode is working, in other words, when the user has clicked and start dragging the mouse button.
Note that when you call this method, the current interactive mode will be canceled if it is working.
This example will change the cursors used in RasterViewerInteractiveMode.MagnifyGlass to be a cross when idle and an empty cursor when working.
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Color;
using Leadtools.Drawing;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
private class ICONINFO
{
public bool fIcon;
public int xHotspot;
public int yHotspot;
public IntPtr hbmMask;
public IntPtr hbmColor;
}
[DllImport("user32.dll")]
private static extern IntPtr CreateIconIndirect([Out] ICONINFO piconinfo);
[DllImport("user32.dll")]
private static extern bool GetIconInfo(IntPtr hIcon, [In, Out] ICONINFO piconinfo);
[DllImport("user32.dll")]
private extern static bool DestroyIcon(IntPtr handle);
private void SetInteractiveModeCursorExample(RasterImageViewer viewer)
{
Cursor idleCursor = Cursors.Cross;
Cursor workingCursor = null;
// Create an empty cursor to use when the magnifying glass is on
// Use the same size as the Cross cursor
using (Bitmap btmp = new Bitmap(idleCursor.Size.Width, idleCursor.Size.Height))
{
using (Graphics g = Graphics.FromImage(btmp))
{
g.Clear(Color.Transparent);
}
ICONINFO iconInfo = new ICONINFO();
IntPtr hIcon = btmp.GetHicon();
GetIconInfo(hIcon, iconInfo);
iconInfo.xHotspot = btmp.Width / 2;
iconInfo.yHotspot = btmp.Height / 2;
iconInfo.fIcon = false;
IntPtr hCursor = CreateIconIndirect(iconInfo);
workingCursor = new Cursor(hCursor);
DestroyIcon(hIcon);
}
viewer.SetInteractiveModeCursor(RasterViewerInteractiveMode.MagnifyGlass, idleCursor, workingCursor);
// Not set the interactive mode to magnify glass
viewer.InteractiveMode = RasterViewerInteractiveMode.MagnifyGlass;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document