Table of Contents

TTMSFNCBloxControl Class

A scrollable, zoomable diagramming surface for creating and editing block diagrams such as flowcharts, UML diagrams, electrical schematics, data-flow diagrams, and arrows.

API unit family: TMSFNCBloxControl Inherits from: TTMSFNCCustomScrollControl Implements: ITMSFNCPersistenceIO

Syntax

TTMSFNCBloxControl = class(TTMSFNCCustomScrollControl, ITMSFNCPersistenceIO)

Remarks

The control hosts a collection of diagram elements exposed through Blox and drives them through an internal presenter exposed through Presenter. It supports persistence to file and stream, image export, undo and redo, rulers, a snap grid, and in-place text editing. End-user interaction is configured through Interaction.

Properties

Name Description
AutoScroll Indicates whether the surface automatically scrolls while dragging an element near its edges.
Blox Provides access to the diagram model that holds all elements, groups, and links on the surface.
DefaultUnit Gets or sets the measurement unit used by the rulers and size calculations.
ElementHandleAppearance Controls the appearance of the resize and connection handles shown for a selected element.
GroupHandleAppearance Controls the appearance of the handles shown for a selected group of elements.
Interaction Provides the end-user interaction settings, such as selection, zooming, read-only mode, and keyboard actions.
LeftRuler Provides the vertical ruler shown along the left of the surface.
Presenter Provides the presenter that drives layout, selection, editing, undo and redo, and rendering of the diagram.
SnapGrid Provides the snap grid that aligns elements to a configurable grid while moving or resizing them.
TopRuler Provides the horizontal ruler shown along the top of the surface.
Zoom Gets or sets the zoom factor of the surface, where 1 represents 100%.

Methods

Name Description
CloseInplaceEditor Closes the active in-place editor.
CreateCanvas Creates the drawing canvas used by the renderer for the supplied graphics context.
EndUpdate Ends a batched update started with BeginUpdate and, when the outermost update completes, recalculates the layout and repaints the surface.
Load Restores the diagram from the internal buffer previously filled by Save.
LoadFromFile Loads a diagram, including its settings, from a file, replacing the current content.
LoadFromStream Loads a diagram, including its settings, from a stream, replacing the current content.
RegisterElements Registers the built-in element shapes that can be created on the surface and raises the registration event so additional shapes can be added.
Save Captures the current diagram into the internal buffer so it can be restored later with Load.
SaveToFile Saves the complete diagram, including its settings, to a file.
SaveToImage Renders the diagram to an image file.
SaveToImageStream Renders the diagram to an image and writes it to a stream.
SaveToStream Saves the complete diagram, including its settings, to a stream.
SavedBlox Returns the content of the internal buffer captured by Save as a string.
ShowInplaceEditor Opens the in-place editor to edit the text of the given element.

Events

Name Description
OnAfterBackgroundRender Occurs after the surface background has been rendered, before the elements are drawn.
OnAfterMove Occurs after one or more elements have been moved.
OnAfterRedo Occurs after a redo operation has been applied.
OnAfterRender Occurs after the diagram foreground has been rendered.
OnAfterResize Occurs after one or more elements have been resized.
OnAfterUndo Occurs after an undo operation has been applied.
OnBeforeRender Occurs before the diagram is rendered.
OnElementClick Occurs when an element is clicked.
OnElementDblClick Occurs when an element is double-clicked.
OnElementInsert Occurs when an element is inserted into the diagram.
OnElementMouseDown Occurs when a mouse button is pressed over an element.
OnElementMouseMove Occurs when the mouse moves over an element.
OnElementMouseUp Occurs when a mouse button is released over an element.
OnElementPainted Occurs after an element has been painted, allowing custom decoration on top of it.
OnElementPainting Occurs before an element is painted, allowing the handler to take over drawing.
OnElementRemove Occurs when an element is removed from the diagram.
OnElementResizing Occurs while an element is being resized.
OnElementSelect Occurs when an element becomes selected.
OnElementUnselect Occurs when an element is deselected.
OnGetInplaceEditorClass Occurs before an element is edited, allowing a custom in-place editor class to be supplied.
OnModified Occurs when the diagram is modified.
OnRegisterElements Occurs while the built-in element shapes are being registered, allowing custom shapes to be added.
OnSelectionChange Occurs when the set of selected elements changes.
OnSetInplaceEditorData Occurs when in-place editing begins, allowing the initial editor text to be provided.
OnSetInplaceEditorElementData Occurs when in-place editing finishes, allowing the edited text to be validated or transformed.
OnSetInplaceEditorSize Occurs before the in-place editor is shown, allowing its bounds to be overridden.
OnZoomChanged Occurs when the zoom factor of the surface changes.

Used by