The CanvasControl is a custom Windows Forms control that can be used to efficiently display all kinds of data.

Namespace: yWorks.Canvas
Assembly: yWorks.yFilesNET.Viewer (in yWorks.yFilesNET.Viewer.dll) Version: 4.1.0.1 (4.1.0.1)

Syntax

C#
[ObfuscationAttribute(StripAfterObfuscation = false, Exclude = true, 
	ApplyToMembers = false)]
public class CanvasControl : Control, 
	ILookup
Visual Basic
<ObfuscationAttribute(StripAfterObfuscation := False, Exclude := True,  _
	ApplyToMembers := False)> _
Public Class CanvasControl _
	Inherits Control _
	Implements ILookup

Remarks

The control supports high performance zooming and panning of visual content. The control uses double precision world-coordinates to render items that are composed using a scene-graph. In its most simple form the scene graph is a tree like structure of elements that will be rendered in depth-first-search order.

The scene graph tree is made up of ICanvasObject elements. Multiple elements are grouped in ICanvasObjectGroup elements. An ICanvasObject consists of a UserObjectuser-object and an ICanvasObjectDescriptor that is used by the rendering engine to query interfaces that perform the actual painting, hit testing, and bounds calculation.

This control comes with a number of default command bindings that work on the view port:

The handlers for IncreaseZoom and DecreaseZoom use the specified command parameter as the factor by which the Zoom value is multiplied or divided, respectively. The parameter is not required. If it is not present a default value is used. The handler for the Zoom command needs a parameter. The parameter can either be a number which is interpreted as the new zoom level, or it can be a suitable object. Supported objects are RectD, Rectangle, PointD, Point and ILookup. If a rectangle is specified as the parameter for the Zoom command, the handler adjusts the Viewport such that the rectangle tightly fits into it. If a point is specified, the handler sets the Center to that point. If the parameter implements ILookup, then the handler tries to get a IBoundsProvider from the lookup and uses the bounds obtained from the bounds provider as the rectangle to zoom to.

Also, Print and PrintPreview are supported out of the box.

In addition to the bindings for existing commands this class declares a new RoutedUICommand, FitContentCommand, that will invoke the FitContent()()()() method.

All commands can be removed from the CommandBindings if desired.

This control offers convenience methods to Print()()()() the contents and export them to EMF files.

Related Reading in the Developer's Guide

CanvasControl is discussed in detail in the section Class CanvasControl.

Related Demo Applications

See the yFiles.NET tutorials for step by step introductions.

Inheritance Hierarchy

System..::..Object
  System..::..MarshalByRefObject
    System.ComponentModel..::..Component
      System.Windows.Forms..::..Control
        yWorks.Canvas..::..CanvasControl
          yWorks.yFiles.UI..::..GraphControl
          yWorks.yFiles.UI..::..GraphOverviewControl

See Also