Interface ICanvas
- Namespace
- CADability
- Assembly
- CADability.dll
Interface must be implemented by a view, which is hosted in a CadCanvas
public interface ICanvas
Properties
ClientRectangle
The area of the canvas that the view paints on, in pixels (the upper left corner is (0, 0)). The views use it to place their projection, see DisplayRectangle.
Rectangle ClientRectangle { get; }
Property Value
Cursor
Sets the cursor defined by the provided id
string Cursor { get; set; }
Property Value
Frame
The IFrame that hosts this canvas. The views use it to reach the project, the action stack, the settings and the IUIService.
IFrame Frame { get; }
Property Value
PaintTo3D
Gets the paint interface to paint the canvas
IPaintTo3D PaintTo3D { get; }
Property Value
Methods
DoDragDrop(GeoObjectList, DragDropEffects)
Starts a drag and drop operation of the framework with the provided objects as the data (the counterpart of the drop handling in OnDragDrop(DragEventArgs)). The call returns when the operation has finished.
DragDropEffects DoDragDrop(GeoObjectList dragList, DragDropEffects all)
Parameters
dragListGeoObjectListThe objects to drag
allDragDropEffectsThe effects (copy, move, link) the source allows
Returns
- DragDropEffects
The effect that was performed by the drop target, None if nothing was dropped
GetView()
Returns the view, which is connected with this canvas
IView GetView()
Returns
Invalidate()
Requests a repaint of the whole canvas. The repaint happens asynchronously: the canvas calls OnPaint(PaintEventArgs) of the connected view when the framework processes the paint message.
void Invalidate()
PointToClient(Point)
Converts a position given in screen coordinates to the client coordinates of this canvas (pixels relative to the upper left corner of the canvas).
Point PointToClient(Point mousePosition)
Parameters
mousePositionPointPosition in screen coordinates
Returns
- Point
The same position in client coordinates of the canvas
ShowContextMenu(MenuWithHandler[], Point, Action<int>)
Shows the provided contextMenu at the provided viewPosition on this canvas
void ShowContextMenu(MenuWithHandler[] contextMenu, Point viewPosition, Action<int> collapsed = null)
Parameters
contextMenuMenuWithHandler[]viewPositionPointcollapsedAction<int>Optional callback which is invoked when the context menu is closed (its int parameter is not used)
ShowToolTip(string)
Show a tooltip with the provided text.
void ShowToolTip(string toDisplay)
Parameters
toDisplaystringthe text to show or null to hide the tooltip
ShowView(IView)
Show the provided view in this canvas.
void ShowView(IView toShow)
Parameters
toShowIView
Events
OnPaintDone
Raised after the canvas has been painted, i.e. after OnPaint(PaintEventArgs) of the view has returned. The handler gets the canvas. SetDirectionAnimated(GeoVector, GeoVector, Model, bool, ICanvas, GeoPoint) uses it to drive the animated change of the view direction: each completed paint triggers the next step.
event Action<ICanvas> OnPaintDone