Class Diagram
Interactive two-dimensional graphics control for diagramming, technical drawing, visualization, simulation, and technical drawing applications.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram.Controls
Assembly: Syncfusion.Diagram.Windows.dll
Syntax
public class Diagram : ScrollControl, IDisposable, ICancelModeProvider, ISplitterPaneSupport, IScrollBarWrapperContainer, ISupportUpdating, ISupportIntelliMouse, IQueryFocusInside, INonClientPaintingSupport, IViewer, IServiceReferenceProvider, ISupportInitialize, IPropertyObserver, IPropertyContainer, IThemeProvider, IVisualStyle
Remarks
This control provides a surface for rendering and manipulating 2D shapes, symbols, text, and images. The user interface supports drag- and-drop, scaling, rotation, zooming, grouping, ungrouping, connection points, and many other features.
A diagram is composed of three objects: the Model, the View, and the Controller. The model-view-controller architecture provides a clear separation between data, visualization, and user interface. The model contains the data portion of the diagram, the view is responsible for rendering the diagram, and the controller handles user interaction. The model, view, and controller are accessible as properties in this control and can be manipulated directly.
Some of the methods and properties in this class are just wrappers that call identical methods in the model, view, or controller. For example, the following two lines of codes are equivalent:
diagram.Undo();
// Same as
diagram.Controller.Undo();
Methods that are simple wrappers are documented as such.
Graphical objects can be added to a diagram in several ways. One way is through drag-and-drop. Symbols can be dragged from a PaletteGroupView onto the diagram. Objects can also be added from the clipboard using the Paste() method. Shapes can be drawn onto the diagram by activating one of several drawing tools such as the RectangleTool. Objects can also be created programmatically and added to the diagram by calling the AppendChild(Node) method.
Activating user-interface tools is a task commonly performed by applications using this control. The ActivateTool(String) method is used to activate tools. For example, the event handler for a toolbar button that draws a rectangle would look like this.
private void drawRectangle_Click(object sender, System.EventArgs e)
{
this.Diagram.ActivateTool("RectangleTool");
}
Calling the Undo() method removes the command on the top of the undo stack and causes an undo to occur. The Redo() method will redo the last command that was removed from the undo stack. The UndoCommand and RedoCommand methods are usually called in response to clicking Undo and Redo on the Edit menu.
One advantage of the model-view-controller architecture is that the parts are interchangeable . Models, views, and controllers can be swapped in and out independently. For example, the user interface of the diagram can be completely replaced by swapping in a different controller implementation. To accomplish this, you must subclass this class and override one or more of the following methods: CreateModel(), CreateView(), CreateController().
Model View Controller Tool ICommandConstructors
Diagram()
Initializes a new instance of the Diagram class.
Declaration
public Diagram()
Diagram(IContainer)
Initializes a new instance of the Diagram class.
Declaration
public Diagram(IContainer container)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.IContainer | container | The container. |
Properties
AllowDrop
Gets or sets a value indicating whether the control accept data that user drags and drops onto it.
Declaration
public override bool AllowDrop { get; set; }
Property Value
Type |
---|
System.Boolean |
BackColor
Declaration
public override Color BackColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BackgroundImage
Gets or sets the background image displayed in the control.
Declaration
public Image BackgroundImage { get; set; }
Property Value
Type |
---|
System.Drawing.Image |
BackgroundImageLayout
Gets or sets the background image layout as defined in the System.Windows.Forms.ImageLayout enumeration.
Declaration
public ImageLayout BackgroundImageLayout { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ImageLayout |
Exceptions
Type | Condition |
---|---|
System.ComponentModel.InvalidEnumArgumentException | The specified enumeration value does not exist. |
Binding
Gets or Sets Bind to get Diagram
Declaration
public Binding Binding { get; set; }
Property Value
Type |
---|
Binding |
CanApplyTheme
Gets or sets a value indicating whether a SkinManager theme style has been applied to the control.
Declaration
public bool CanApplyTheme { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
CanCopy
Gets a value indicating whether there are any selected nodes that can be copied to the clipboard.
Declaration
public bool CanCopy { get; }
Property Value
Type |
---|
System.Boolean |
Remarks
Wrapper for CanCopy.
CanCut
Gets a value indicating whether there are any selected nodes that can be removed from the the model.
Declaration
public bool CanCut { get; }
Property Value
Type |
---|
System.Boolean |
Remarks
Wrapper for CanCut.
CanOverrideStyle
Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.
Declaration
public bool CanOverrideStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value is false. |
Remarks
By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.
CanPaste
Gets a value indicating whether there is any data in the clipboard that can be pasted into the model.
Declaration
public bool CanPaste { get; }
Property Value
Type |
---|
System.Boolean |
Remarks
Wrapper for CanPaste.
Controller
Gets or sets the controller processes input and translates it into commands and actions on the model and view.
Declaration
public DiagramController Controller { get; set; }
Property Value
Type |
---|
DiagramController |
Remarks
The controller defines the user interface. It is created by calling the virtual method's CreateController(). The CreateController method can be overridden in derived classes in order to plug custom controllers into the diagram.
DefaultContextMenuEnabled
Gets or sets a value indicating whether to enable the built-in context menu for Diagram Windows Form control.
Declaration
public bool DefaultContextMenuEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Document
Gets or sets the current diagram document that contain Model, View and Controller components.
Declaration
public DiagramDocument Document { get; set; }
Property Value
Type | Description |
---|---|
DiagramDocument | The diagram document. |
Remarks
Uses to open document in design mode. Can be null.
EventSink
Gets the reference to viewer event sink.
Declaration
public ViewerEventSink EventSink { get; }
Property Value
Type | Description |
---|---|
ViewerEventSink | The event sink. |
FocusManager
Gets the focus manager reference.
Declaration
public FocusManager FocusManager { get; }
Property Value
Type | Description |
---|---|
FocusManager | The focus manager. |
FocusNodeOnTab
Gets or sets the Tab behavior needed for diagram control.
Declaration
public bool FocusNodeOnTab { get; set; }
Property Value
Type |
---|
System.Boolean |
FullContainerName
Gets the full name of the container.
Declaration
public string FullContainerName { get; }
Property Value
Type | Description |
---|---|
System.String | The full name of the container. |
HorizontalRuler
Gets or sets the horizontal ruler.
Declaration
public Ruler HorizontalRuler { get; set; }
Property Value
Type | Description |
---|---|
Ruler | The horizontal ruler. |
LayoutManager
Gets or sets layout manager responsible for updating the layout of the diagram.
Declaration
public LayoutManager LayoutManager { get; set; }
Property Value
Type |
---|
LayoutManager |
Magnification
Gets the magnification percent.
Declaration
public float Magnification { get; }
Property Value
Type | Description |
---|---|
System.Single | The magnification percent. |
Model
Gets or sets the model contains the hierarchy of graphical nodes that are rendered onto the view and manipulated by the controller.
Declaration
public Model Model { get; set; }
Property Value
Type |
---|
Model |
Remarks
The model contains the data portion of a diagram. When a diagram is persisted, it is the Model that is serialized. The model is created by calling the virtual method CreateModel(). The CreateModel method can be overridden in derived classes in order to plug custom models into the diagram. Model
NudgeIncrement
Gets or sets number of logical units to move nodes during a nudge operation.
Declaration
public float NudgeIncrement { get; set; }
Property Value
Type |
---|
System.Single |
Origin
Gets the view origin.
Declaration
public PointF Origin { get; }
Property Value
Type | Description |
---|---|
System.Drawing.PointF | The origin. |
RulersHeight
Gets or sets the height of the rulers.
Declaration
public int RulersHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The height of the rulers. |
ScrollGranularity
Gets or sets the level of granularity for scrolling.
Declaration
public float ScrollGranularity { get; set; }
Property Value
Type |
---|
System.Single |
Remarks
This value is to scale the scroll range of the scroll bars. The value of this property must be greater than 0. This value is multiplied by virtual size of the view in order to get the scroll range. For example, if the virtual size of the view is 100x50 and this property is set to 0.5f, then the horizontal scroll range is set to 0..50 and the vertical scroll range is set to 0..25.
ScrollVirtualBounds
Gets or sets the bounds of scrollable area. Can be set only positive values.
Declaration
public RectangleF ScrollVirtualBounds { get; set; }
Property Value
Type |
---|
System.Drawing.RectangleF |
ShowRulers
Gets or sets a value indicating whether view show horizontal and vertical rulers.
Declaration
public bool ShowRulers { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ThemeName
Gets or sets the theme name of the Diagram control.
Declaration
public string ThemeName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value is null. |
Remarks
The theme will be applied only when the particular theme for this control has included the Themes assembly.
ThemeStyle
Declaration
public DiagramVisualStyle ThemeStyle { get; set; }
Property Value
Type |
---|
DiagramVisualStyle |
TouchMode
Gets or sets the value indicating that whether the touch mode is enabled or not.
Declaration
public bool TouchMode { get; set; }
Property Value
Type |
---|
System.Boolean |
VerticalRuler
Gets or sets the vertical ruler.
Declaration
public Ruler VerticalRuler { get; set; }
Property Value
Type | Description |
---|---|
Ruler | The vertical ruler. |
View
Gets or sets the view is responsible for rendering the model onto a window.
Declaration
public View View { get; set; }
Property Value
Type |
---|
View |
Remarks
A view is set inside of a window and has bounds that are measured in device coordinates. The view renders itself onto a System.Drawing.Graphics object. The view is created by calling the virtual method CreateView(). The CreateView method can be overridden in derived classes in order to plug custom views into the diagram. View
VisualStyle
Gets or sets an advanced appearance for the diagram.
Declaration
public DiagramStyle VisualStyle { get; set; }
Property Value
Type |
---|
DiagramStyle |
Methods
ActivateTool(String)
Activates the specified tool in the controller.
Declaration
public bool ActivateTool(string toolName)
Parameters
Type | Name | Description |
---|---|---|
System.String | toolName | Name of tool to activate. |
Returns
Type | Description |
---|---|
System.Boolean | True if tool activated; otherwise False. |
AcumulateHRulerInvalidArea(Rectangle)
Accumulates the H ruler invalid area.
Declaration
protected Rectangle AcumulateHRulerInvalidArea(Rectangle rectHightlight)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rectHightlight | The highlight rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Bounds of the horizontal ruler. |
AcumulateVRulerInvalidArea(Rectangle)
Accumulates the V ruler invalid area.
Declaration
protected Rectangle AcumulateVRulerInvalidArea(Rectangle rectHightlight)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rectHightlight | The highlight rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Bounds of the vertical ruler. |
AlignBottom()
Aligns all the nodes/connectors in the selection list with respect to bottom edge of the first node in the selection boundary.
Declaration
public void AlignBottom()
AlignCenter()
Aligns the selected nodes along the vertical center of the first node.
Declaration
public void AlignCenter()
AlignLeft()
Aligns all the nodes/connectors in the selection list with respect to left edge of the first node in the selection boundary.
Declaration
public void AlignLeft()
AlignMiddle()
Aligns the selected nodes along the horizontal center of the first node.
Declaration
public void AlignMiddle()
AlignRight()
Aligns all the nodes/connectors in the selection list with respect to right edge of the first node in the selection boundary.
Declaration
public void AlignRight()
AlignTop()
Aligns all the nodes/connectors in the selection list with respect to top edge of the first node in the selection boundary.
Declaration
public void AlignTop()
AttachModel(Model)
Attach an existing model to the diagram.
Declaration
public void AttachModel(Model value)
Parameters
Type | Name | Description |
---|---|---|
Model | value | Model object to attach. |
Remarks
This method can be used to attach a new model object to the diagram. NOTE: Using this method will cause the contents of the previous model to be destroyed. Calling this method after your form's InitializeComponent method is called will cause design-time property values to be lost.
BeginInit()
Signals the object that initialization is starting.
Declaration
public void BeginInit()
BeginUpdate(BeginUpdateOptions)
Suspends the painting of the control until the EndUpdate() method is called.
Declaration
public override void BeginUpdate(BeginUpdateOptions options)
Parameters
Type | Name | Description |
---|---|---|
BeginUpdateOptions | options | Specifies the painting support during the BeginUpdate, EndUpdate batch. |
Overrides
Remarks
When many paints are made to the appearance of a control, you should invoke the BeginUpdate method to temporarily freeze the drawing of the control. This results in less distraction to the user and a performance gain. After all updates have been made, invoke the EndUpdate method to resume drawing of the control.
Pass BeginUpdateOptions if you do not want to do a complete Refresh of the control and instead want to have certain regions of your control be invalidated or scroll the contents of control.
If you call BeginUpdate() and then later EndUpdate(), the control will know if a paint is pending and only refresh the control if a paint is pending. Calling ShouldPrepareUpdate, Invalidate or a WM_PAINT message during the BeginUpdate EndUpdate block will signal the control that a paint is pending.See Also
CanPerformMoving()
Checks if move operation can be done.
Declaration
protected bool CanPerformMoving()
Returns
Type | Description |
---|---|
System.Boolean | value specifying if we can perform move operation |
Remarks
If we are editing text from Text or RichText node skip moving
Copy()
Copy the currently selected nodes to the clipboard.
Declaration
public void Copy()
Remarks
Wrapper for Copy().
CreateController()
This method creates the controller that is attached to the diagram.
Declaration
public virtual DiagramController CreateController()
Returns
Type | Description |
---|---|
DiagramController | Controller object to attach. |
Remarks
This method can be overidden in derived classes in order to perform custom initialization of the controller or to create custom controllers derived from the Controller class.
CreateModel()
This method creates the model that is attached to the diagram.
Declaration
public virtual Model CreateModel()
Returns
Type | Description |
---|---|
Model | A new model object. |
Remarks
This method can be overidden in derived classes in order to perform custom initialization of the model or to create custom models derived from the Model class.
CreatePrintDocument()
Creates an instance of the DiagramPrintDocument and initializes it with the diagram's view.
Declaration
public virtual DiagramPrintDocument CreatePrintDocument()
Returns
Type | Description |
---|---|
DiagramPrintDocument | Diagram print document |
CreateView()
This method creates the view that is attached to the diagram.
Declaration
public virtual View CreateView()
Returns
Type | Description |
---|---|
View | An instance of the View type. |
Remarks
Override this method to create a custom View for the diagram control.
Cut()
Remove the currently selected nodes from the diagram and move them to the clipboard.
Declaration
public void Cut()
Remarks
Wrapper for Cut().
DetachContextMenu()
Set the ContextMenu to NULL.
Declaration
public void DetachContextMenu()
Dispose(Boolean)
Clean up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
DrawHandles(Graphics, NodeCollection)
Draws the handles to graphics.
Declaration
protected virtual void DrawHandles(Graphics grfx, NodeCollection nodesSelected)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | grfx | Graphics to draw on. |
NodeCollection | nodesSelected | The nodes selected. |
EndInit()
Signals the object that initialization is complete.
Declaration
public void EndInit()
EndUpdate(Boolean)
Resumes the painting of the control suspended by calling the BeginUpdate method.
Declaration
public override void EndUpdate(bool update)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | update | true, if update is suspended. |
Overrides
Remarks
When many paint are made to the appearance of a control you should invoke the BeginUpdate method to temporarily freeze the drawing of the control. This results in less distraction to the user, and a performance gain. After all updates have been made, invoke the EndUpdate method to resume drawing of the control.
EventSink_DocumentBeginUpdate(Object, EventArgs)
Handles the DocumentBeginUpdate event.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_DocumentBeginUpdate(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | The System.EventArgs instance containing the event data. |
EventSink_DocumentEndUpdate(Object, EventArgs)
Handles the DocumentEndUpdate event.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_DocumentEndUpdate(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | The System.EventArgs instance containing the event data. |
EventSink_NodeCollectionChanged(CollectionExEventArgs)
Fires when node collection is changed.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
CollectionExEventArgs | evtArgs | The CollectionExEventArgs instance containing the event data. |
EventSink_PinOffsetChanged(PinOffsetChangedEventArgs)
Fires when pin offset is changed.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_PinOffsetChanged(PinOffsetChangedEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
PinOffsetChangedEventArgs | evtArgs | The PinOffsetChangedEventArgs instance containing the event data. |
EventSink_PinPointChanged(PinPointChangedEventArgs)
Fires when pin point is changed.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_PinPointChanged(PinPointChangedEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
PinPointChangedEventArgs | evtArgs | The PinPointChangedEventArgs instance containing the event data. |
EventSink_RotationChanged(RotationChangedEventArgs)
Fires when node is rotated.
Declaration
[EventHandlerPriority(true)]
protected void EventSink_RotationChanged(RotationChangedEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
RotationChangedEventArgs | evtArgs | The RotationChangedEventArgs instance containing the event data. |
ExportDiagramAsImage(Boolean)
Exports a representation of the Diagram as a image.
Declaration
public virtual Image ExportDiagramAsImage(bool bClipModelBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bClipModelBounds | Indicates whether image will be clipped by model bounds. |
Returns
Type | Description |
---|---|
System.Drawing.Image | Diagram representation as Image |
ExportDiagramAsImage(Boolean, PixelFormat)
Exports a representation of the Diagram as a image with given format.
Declaration
public virtual Image ExportDiagramAsImage(bool bClipModelBounds, PixelFormat pixelFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bClipModelBounds | Indicates whether image will be clipped by model bounds. |
System.Drawing.Imaging.PixelFormat | pixelFormat | given pixel format |
Returns
Type | Description |
---|---|
System.Drawing.Image | Diagram representation as Image |
ExportDiagramToGraphics(Graphics)
Renders a representation of the Diagram onto the provided System.Drawing.Graphics object.
Declaration
public virtual void ExportDiagramToGraphics(Graphics grfx)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | grfx | Graphics to draw on. |
ExportDiagramToGraphics(Graphics, RectangleF)
Renders a representation of the Diagram onto the provided System.Drawing.Graphics object to specified rectangle.
Declaration
public virtual void ExportDiagramToGraphics(Graphics grfx, RectangleF rcArea)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | grfx | Graphics to draw on. |
System.Drawing.RectangleF | rcArea | The area. |
FitDocument()
Fit the document on control field.
Declaration
public void FitDocument()
FlipHorizontal()
FlipHorizontal command is used to mirror a diagram selected object’s content in Horizontal (X) axis only.
Declaration
public void FlipHorizontal()
FlipVertical()
FlipVertical command is used to mirror a diagram selected object’s content in Horizontal (Y) axis only.
Declaration
public void FlipVertical()
GetActiveThemeName()
Gets the active theme name of the Diagram control.
Declaration
public string GetActiveThemeName()
Returns
Type | Description |
---|---|
System.String | Returns the active theme name. |
GetDataSourceFromXML(String)
Load Xml file converting to DataTable
Declaration
public DataTable GetDataSourceFromXML(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | Xml file path |
Returns
Type |
---|
System.Data.DataTable |
GetPropertyContainer(String)
Gets the property container.
Declaration
protected virtual object GetPropertyContainer(string strPropertyContainerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyContainerName | Name of the property container. |
Returns
Type | Description |
---|---|
System.Object | Object containing the property container. |
GetPropertyContainerByName(String)
Gets the property container by name.
Declaration
public object GetPropertyContainerByName(string strPropertyContainerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyContainerName | Name of the property container. |
Returns
Type | Description |
---|---|
System.Object | Object that contains the name of the property container. |
GetSelectionList()
Gets the selection list.
Declaration
protected NodeCollection GetSelectionList()
Returns
Type | Description |
---|---|
NodeCollection | The nodes in the selection. |
GetService(Type)
Returns an object that represents a service provided by the System.ComponentModel.Component or by its System.ComponentModel.Container.
Declaration
protected override object GetService(Type service)
Parameters
Type | Name | Description |
---|---|---|
System.Type | service | A service provided by the System.ComponentModel.Component. |
Returns
Type | Description |
---|---|
System.Object | An System.Object that represents a service provided by the System.ComponentModel.Component, or null if the System.ComponentModel.Component does not provide the specified service. |
HookViewEvents()
Hooks up event handlers to the view.
Declaration
protected virtual void HookViewEvents()
IsEditing()
Determines whether this instance is editing.
Declaration
protected bool IsEditing()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsInputKey(Keys)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
Declaration
protected override bool IsInputKey(Keys keyData)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Keys | keyData | One of the System.Windows.Forms.Keys values. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified key is a regular input key; otherwise, false. |
Load(Stream)
Loads the specified stream.
Declaration
public virtual void Load(Stream strm)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strm | The stream. |
Load(Stream, out Exception)
Loads the specified stream.
Declaration
public virtual void Load(Stream strm, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strm | The stream. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
Load(String)
Loads the specified file name.
Declaration
public virtual void Load(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
Load(String, out Exception)
Loads the specified file name.
Declaration
public virtual void Load(string fileName, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
LoadBinary(Stream)
Loads the diagram from a stream in binary format.
Declaration
public virtual void LoadBinary(Stream strmIn)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream to serialize the diagram from. |
LoadBinary(Stream, out Exception)
Loads the diagram from a stream in binary format.
Declaration
public virtual void LoadBinary(Stream strmIn, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream to serialize the diagram from. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
LoadBinary(String)
Loads the diagram from a file in binary format.
Declaration
public virtual void LoadBinary(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to load from. |
LoadBinary(String, out Exception)
Loads the diagram from a file in binary format.
Declaration
public virtual void LoadBinary(string fileName, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to load from. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
LoadSoap(Stream)
Loads the diagram from a stream in SOAP format.
Declaration
public virtual void LoadSoap(Stream strmIn)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream to serialize the diagram into. |
LoadSoap(Stream, out Exception)
Loads the diagram from a stream in SOAP format.
Declaration
public virtual void LoadSoap(Stream strmIn, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream to serialize the diagram into. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
LoadSoap(String)
Loads the diagram from a file in SOAP format.
Declaration
public virtual void LoadSoap(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to load from. |
LoadSoap(String, out Exception)
Loads the diagram from a file in SOAP format.
Declaration
public virtual void LoadSoap(string fileName, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to load from. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
LoadXml(Stream)
Loads the diagram from a stream in xml format.
Declaration
public void LoadXml(Stream strmIn)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream which is used to deserialize the Diagram. |
LoadXml(Stream, out Exception)
Loads the diagram from a stream in xml format.
Declaration
public void LoadXml(Stream strmIn, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmIn | Stream which is used to deserialize the Diagram. |
System.Exception | exception | Get the exception during deserialization if exception occurs. |
LoadXml(String)
Loads the diagram from a file in xml format.
Declaration
public void LoadXml(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file which is used to deserialize the Diagram. |
LoadXml(String, out Exception)
Loads the diagram from a file in xml format.
Declaration
public void LoadXml(string fileName, out Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file which is used to deserialize the Diagram. |
System.Exception | exception | Get the exception during deserialization if exception occurs |
MoveNodes(NodeCollection, Single, Single, MeasureUnits)
Moves the specified nodes by a X and Y offset.
Declaration
public bool MoveNodes(NodeCollection nodes, float dx, float dy, MeasureUnits units)
Parameters
Type | Name | Description |
---|---|---|
NodeCollection | nodes | Nodes to be moved. |
System.Single | dx | Distance to move along the X axis. |
System.Single | dy | Distance to move along the Y axis. |
MeasureUnits | units | Move offsets measure units. |
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
MVCDispose()
Destroys the model, view, and controller and ensures that they are completely disconnected from the diagram control.
Declaration
protected virtual void MVCDispose()
MVCInit()
Wires up the model, view, and controller and performs necessary initialization.
Declaration
protected virtual void MVCInit()
Remarks
This method does not create the model, view, and controller objects. It assumes that the mode, view, and controller objects have already been created. This method hooks the model to the view and hooks the view to the controller.
NudgeDown()
NudgeDown command is used to move the selected object towards down by the specified NudgeIncrement units.
Declaration
public bool NudgeDown()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
NudgeLeft()
NudgeLeft command is used to move the selected object towards down by the specified NudgeIncrement units.
Declaration
public bool NudgeLeft()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
NudgeRight()
NudgeRight command is used to move the selected object towards down by the specified NudgeIncrement units.
Declaration
public bool NudgeRight()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
NudgeUp()
NudgeUp command is used to move the selected object towards down by the specified NudgeIncrement units.
Declaration
public bool NudgeUp()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
OnClick(EventArgs)
Raises the System.Windows.Forms.Control.Click event.
Declaration
protected override void OnClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
OnDiagramInitialized(Object, EventArgs)
Called when diagram is initialized
Declaration
protected virtual void OnDiagramInitialized(object sender, EventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender |
System.EventArgs | evtArgs | Event args |
OnDoubleClick(EventArgs)
Raises the System.Windows.Forms.Control.DoubleClick event.
Declaration
protected override void OnDoubleClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
OnDragDrop(DragEventArgs)
Called when objects are dropped onto the diagram.
Declaration
protected override void OnDragDrop(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.DragEventArgs | e | Event arguments. |
Remarks
Looks to see if a NodeCollection is available in the System.Windows.Forms.IDataObject provided in the event arguments. If so, the NodeCollection is retrieved and added to the diagram. OnDragEnter(DragEventArgs) OnDragLeave(EventArgs)
OnDragEnter(DragEventArgs)
Called when the mouse enters the diagram during a drag operation.
Declaration
protected override void OnDragEnter(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.DragEventArgs | e | Event arguments. |
Remarks
Looks to see if a NodeCollection is available in the System.Windows.Forms.IDataObject provided in the event arguments. If so, the aggregate bounds of the nodes is calculated and a tracking rectangle is created to track the nodes as they are dragged across the diagram. OnDragDrop(DragEventArgs) OnDragLeave(EventArgs)
OnDragLeave(EventArgs)
Called when mouse leaves the diagram during a drag operation.
Declaration
protected override void OnDragLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event arguments. |
Remarks
Clears the tracking rectangle. OnDragEnter(DragEventArgs) OnDragDrop(DragEventArgs)
OnDragOver(DragEventArgs)
Called when objects are dragged over the control.
Declaration
protected override void OnDragOver(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.DragEventArgs | e | Event arguments. |
Overrides
Remarks
Updates tracking when objects are dragged over the diagram.
OnGotFocus(EventArgs)
Raises the Got Focus event.
Declaration
protected override void OnGotFocus(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnHScroll(Object, ScrollEventArgs)
Called when the horizontal scrollbar is moved.
Declaration
protected override void OnHScroll(object sender, ScrollEventArgs se)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Object sending the event. |
System.Windows.Forms.ScrollEventArgs | se | Event arguments. |
Overrides
Remarks
Scrolls the window origin by the specified amount.
OnHScrollBarValueChanged(Object, EventArgs)
Called when the value of the horizontal scroll bar changes.
Declaration
protected override void OnHScrollBarValueChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Object sending the event. |
System.EventArgs | e | Event arguments. |
Overrides
Remarks
Updates the Origin property of the view.
OnKeyDown(KeyEventArgs)
Raises the System.Windows.Forms.Control.KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | A System.Windows.Forms.KeyEventArgs that contains the event data. |
OnKeyPress(KeyPressEventArgs)
Raises the System.Windows.Forms.Control.KeyPress event.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyPressEventArgs | e | A System.Windows.Forms.KeyPressEventArgs that contains the event data. |
OnKeyUp(KeyEventArgs)
Raises the System.Windows.Forms.Control.KeyUp event.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | A System.Windows.Forms.KeyEventArgs that contains the event data. |
OnLayoutUpdated(Object, EventArgs)
Called after the layout manager updates the model.
Declaration
protected virtual void OnLayoutUpdated(object sender, EventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Layout manager sending the event. |
System.EventArgs | evtArgs | Event arguments. |
OnLostFocus(EventArgs)
Raises the Lost Focus event.
Declaration
protected override void OnLostFocus(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnMouseDown(MouseEventArgs)
Raises the Mouse Down event.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnMouseEnter(EventArgs)
Raises the System.Windows.Forms.Control.MouseEnter event.
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
OnMouseLeave(EventArgs)
Raises the mouse leave event.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnMouseMove(MouseEventArgs)
Raises the mouse move event.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnMouseUp(MouseEventArgs)
Raises the mouse up event.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnMouseWheelZoom(MouseWheelZoomEventArgs)
Called when the diagram is zoomed through mouse wheel.
Declaration
protected override void OnMouseWheelZoom(MouseWheelZoomEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseWheelZoomEventArgs | e | MouseWheelZoomEventArgs |
Overrides
OnPaint(PaintEventArgs)
Called when the control needs to paint the window.
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e | Event arguments. |
Overrides
Remarks
This method draws the view onto the System.Drawing.Graphics object provided by the System.Windows.Forms.PaintEventArgs parameter. The view is drawn by calling the Draw(Graphics, RectangleF) method.
OnPaintBackground(PaintEventArgs)
Called when the control needs to clear the background.
Declaration
protected override void OnPaintBackground(PaintEventArgs pevent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | pevent | Event arguments. |
Remarks
This method does nothing. It is overridden to prevent the control from painting the background in order to eliminate flicker.
OnPropertyChanged(String)
Called when property changed.
Declaration
protected virtual void OnPropertyChanged(string strPropertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyName | Name of the property. |
OnPropertyChanged(String, String)
Called when property is changed.
Declaration
public void OnPropertyChanged(string strPropertyFullPath, string strPropertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyFullPath | The full path. |
System.String | strPropertyName | The property name. |
OnPropertyChanging(String, Object)
Called when property changing.
Declaration
protected virtual bool OnPropertyChanging(string strPropertyName, object newValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyName | Name of the property. |
System.Object | newValue | The new value. |
Returns
Type | Description |
---|---|
System.Boolean | true, if property is changing. |
OnPropertyChanging(String, String, Object)
Called when property is changing.
Declaration
public bool OnPropertyChanging(string strPropertyFullPath, string strPropertyName, object oldValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyFullPath | The full path. |
System.String | strPropertyName | The Name. |
System.Object | oldValue | The old value. |
Returns
Type | Description |
---|---|
System.Boolean | true, if property changing |
OnSetCursor(ref Message)
OnSetCursor. Overriden
Declaration
protected override void OnSetCursor(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The Message |
Overrides
OnShowContextMenu(ShowContextMenuEventArgs)
Raises the ShowContextMenu event when the user right-clicks inside the control.
Declaration
protected override void OnShowContextMenu(ShowContextMenuEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
ShowContextMenuEventArgs | e | Context menu event args. |
Overrides
Remarks
Raises the ShowContextMenu event when the user right-clicks inside the control.
You can cancel showing a content menu when you assign True to System.ComponentModel.CancelEventArgs.Cancel.
OnSizeChanged(EventArgs)
Called when the control is resized.
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event arguments. |
Overrides
Remarks
Updates the size of the View to match the new size of the control.
OnStartAutoScrolling(StartAutoScrollingEventArgs)
Declaration
protected override void OnStartAutoScrolling(StartAutoScrollingEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
StartAutoScrollingEventArgs | e |
Overrides
OnViewOriginChanged(ViewOriginEventArgs)
Raises the ViewOriginChanged event.
Declaration
[EventHandlerPriority(true)]
protected virtual void OnViewOriginChanged(ViewOriginEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
ViewOriginEventArgs | evtArgs | The ViewOriginEventArgs instance containing the event data. |
OnViewPropertyChanged(PropertyChangedEventArgs)
Raises the ViewPropertyChanged event.
Declaration
[EventHandlerPriority(true)]
protected virtual void OnViewPropertyChanged(PropertyChangedEventArgs evtArgs)
Parameters
Type | Name | Description |
---|---|---|
PropertyChangedEventArgs | evtArgs | The PropertyChangedEventArgs instance containing the event data. |
OnVScroll(Object, ScrollEventArgs)
Called when the vertical scrollbar is moved.
Declaration
protected override void OnVScroll(object sender, ScrollEventArgs se)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Object sending the event. |
System.Windows.Forms.ScrollEventArgs | se | Event arguments. |
Overrides
Remarks
Scrolls the window origin by the specified amount.
OnVScrollBarValueChanged(Object, EventArgs)
Called when the value of the vertical scroll bar changes.
Declaration
protected override void OnVScrollBarValueChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Object sending the event. |
System.EventArgs | e | Event arguments. |
Overrides
Remarks
Updates the Origin property of the view.
Paste()
Paste the contents of the clipboard to the diagram.
Declaration
public void Paste()
Paste(String, PointF)
Paste the contents of the clipboard to the diagram at the specified layer and location.
Declaration
public void Paste(string layername, PointF location)
Parameters
Type | Name | Description |
---|---|---|
System.String | layername | The layername. |
System.Drawing.PointF | location | The location. |
ProcessCmdKey(ref Message, Keys)
Processes a command key.
Declaration
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | msg | A System.Windows.Forms.Message, passed by reference, that represents the window message to process. |
System.Windows.Forms.Keys | keyData | One of the System.Windows.Forms.Keys values that represents the key to process. |
Returns
Type | Description |
---|---|
System.Boolean | true if the character was processed by the control; otherwise, false. |
ProvideServiceReference(RuntimeTypeHandle)
Get the service reference from provider.
Declaration
public object ProvideServiceReference(RuntimeTypeHandle typeHandle)
Parameters
Type | Name | Description |
---|---|---|
System.RuntimeTypeHandle | typeHandle | The service type. |
Returns
Type |
---|
System.Object |
RaiseThemeChanged(Object, ThemeChangedEventArgs)
Raises the ThemeNameChanged event when themename changed.
Declaration
public void RaiseThemeChanged(object sender, ThemeChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender value. |
ThemeChangedEventArgs | args | A ThemeChangedEventArgs contains the event data. |
Rotate(Single)
Rotates the selected nodes about their local origin by the specified number of degrees.
Declaration
public bool Rotate(float degrees)
Parameters
Type | Name | Description |
---|---|---|
System.Single | degrees | Number of degrees to rotate. |
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
SameHeight()
Same Height commands allows you to equally size the selected nodes with respect to the first selected object.
Declaration
public bool SameHeight()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
SameSize()
Sizing commands allows you to equally size the selected nodes with respect to the first selected object.
Declaration
public bool SameSize()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
SameWidth()
Same Width commands allows you to equally size the selected nodes with respect to the first selected object.
Declaration
public bool SameWidth()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; otherwise False. |
SaveBinary(Stream)
Saves the diagram to a stream in binary format.
Declaration
public virtual void SaveBinary(Stream strmOut)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmOut | Stream to serialize the diagram into. |
SaveBinary(String)
Saves the diagram to a file in binary format.
Declaration
public virtual void SaveBinary(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to save to. |
SaveSoap(Stream)
Saves the diagram to a stream in SOAP format.
Declaration
public virtual void SaveSoap(Stream strmOut)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmOut | Stream to serialize the diagram into. |
SaveSoap(String)
Saves the diagram to a file in SOAP format.
Declaration
public virtual void SaveSoap(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to save to. |
SaveXml(Stream)
Saves the diagram to a stream in xml format.
Declaration
public void SaveXml(Stream strmOut)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | strmOut | Stream to serialize the Diagram. |
SaveXml(String)
Saves the diagram to a file in xml format.
Declaration
public void SaveXml(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of file to save the Diagram. |
SelectAll()
Adds all nodes in the model to the SelectionList.
Declaration
public void SelectAll()
Remarks
Wrapper for SelectAll().
SetMagnification(Int32, Int32)
Sets the X and Y magnification (zoom) values on a scale of 1 to n.
Declaration
public void SetMagnification(int magX, int magY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | magX | Magnification percent along X axis. |
System.Int32 | magY | Magnification percent along Y axis. |
Remarks
This method sets the Magnification property.
SpaceAcross()
Space Across commands allows you to place the selected objects on the page at equal Horizontal intervals from each other.
Declaration
public void SpaceAcross()
SpaceDown()
Space Down commands allows you to place the selected objects on the page at equal vertical intervals from each other.
Declaration
public void SpaceDown()
SubscribeForModelEvents(Model)
Subscribes for model events.
Declaration
protected void SubscribeForModelEvents(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model | The model. |
UnhookViewEvents()
Unhooks event handlers from the view.
Declaration
protected virtual void UnhookViewEvents()
UnsubscribeForModelEvents(Model)
Unsubscribes for model events.
Declaration
protected void UnsubscribeForModelEvents(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model | The model. |
UpdateScrollRange()
This method sets the range on the horizontal and vertical scrollbars.
Declaration
public virtual void UpdateScrollRange()
Remarks
The scroll range for the scrollbars is determined by the VirtualSize property of the view and the ScrollGranularity property.
UpdateScrolls(PointF)
Update the scroll position from new origin.
Declaration
protected virtual void UpdateScrolls(PointF ptNewOrigin)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptNewOrigin | The new origin position. |
UpdateView()
Updates the view area.
Declaration
public void UpdateView()
UpdateView(Node)
Updates the view area
The node.Declaration
public void UpdateView(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node |
WndProc(ref Message)
Processes Windows messages.
Declaration
protected override void WndProc(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The Windows System.Windows.Forms.Message to process. |
Overrides
ZoomTo(ZoomParameters)
Declaration
public void ZoomTo(ZoomParameters zoom)
Parameters
Type | Name | Description |
---|---|---|
ZoomParameters | zoom |
Events
ThemeNameChanged
Occurs when theme name of the Diagram has changed.
Declaration
public event ThemeChangedEventHandler ThemeNameChanged
Event Type
Type |
---|
ThemeChangedEventHandler |
Explicit Interface Implementations
IVisualStyle.VisualTheme
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.BaseThemeName
Gets or sets the Base Theme name of the theme
Declaration
string IThemeProvider.BaseThemeName { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.ControlName
Declaration
string IThemeProvider.ControlName { get; }
Returns
Type |
---|
System.String |