Keyboard and Mouse
Every shortcut the canvas handles out of the box
DrawingManager.HandleKeyDown(keyCode, modifiers) implements the standard editor shortcuts, and the host control routes mouse input to HandleMouseDown/Move/Up/Wheel in world coordinates. This page is the complete reference.
Table of Contents
Editing
| Shortcut | Action | API |
|---|---|---|
| Ctrl+Z | Undo | Undo() |
| Ctrl+Y | Redo | Redo() |
| Ctrl+C | Copy the selection (components and their internal lines) | CopySelectedComponents() |
| Ctrl+X | Cut the selection | CopySelectedComponents() + DeleteSelectedComponents() |
| Ctrl+V | Paste at the pointer position | PasteComponents(point) |
| Delete / Backspace | Delete the selection (components plus attached lines, one undo step) | DeleteSelectedComponents() |
| Ctrl+S | Request a save; the host handles it | SaveRequested event |
Selection and Navigation
| Shortcut | Action | API |
|---|---|---|
| Ctrl+A | Select all components | SelectAllComponents() |
| Tab / Shift+Tab | Cycle the selection forwards / backwards (keyboard accessibility) | SelectNextComponent(forward) |
| Escape | Clear the selection | SelectionManager.ClearSelection() |
| ← → ↑ ↓ | Move the selection by 1 unit | MoveSelectedComponents(offset) |
| Shift+arrows | Move the selection by 10 units | MoveSelectedComponents(offset) |
Arrow-key moves are recorded on the undo stack like any other move, so they can be undone individually.
View and Canvas
| Shortcut | Action | API |
|---|---|---|
| + / - (and numpad) | Zoom in / out by 10%, clamped to 0.1x – 5x | Zoom |
| Ctrl+G | Toggle the grid | ShowGrid |
| Ctrl+T | Toggle the theme (light / dark) | ThemeManager.ApplyTheme |
| F1 | Open the documentation (host feature; the WinForms sample implements it) | host |
Mouse
| Gesture | Action |
|---|---|
| Click a component | Select it |
| Ctrl+click / Shift+click | Add to or toggle the selection |
| Drag a component | Move it (with snapping when enabled); multi-selection moves together |
| Drag from a port | Draw a connection; release on a compatible port to connect |
| Drag on empty canvas | Marquee selection |
| Drag a resize handle | Resize the component (eight handles) |
| Right-click a component or the canvas | Context menu (ComponentRightClicked / DiagramRightClicked) |
| Double-click a component | Drill-down hook (ComponentDoubleClicked) |
| Mouse wheel | Zoom around the pointer (HandleMouseWheel) |
| Middle-button drag | Pan the viewport (InteractionHelper.IsPanning) |
Host Integration
The manager handles keys; the host forwards them. In WinForms that is a single call per key, with modifiers mapped to SKKeyModifiers:
int mods = 0;
if (e.Control) mods |= 1;
if (e.Shift) mods |= 2;
if (e.Alt) mods |= 4;
if (drawingManager.HandleKeyDown((int)e.KeyCode, mods))
{
e.Handled = true; // the manager consumed the key
e.SuppressKeyPress = true;
}
HandleKeyDown returns true when it acted on the key, so hosts can keep their own shortcuts (F1, menus, save dialogs) by handling them first. To rebind a shortcut, intercept the key in the host and call the corresponding manager API instead.