TX Text Control .NET for Windows Forms

TXDrawingCore Class

Class|Introduced in 33.0
Namespace
TXTextControl.Drawing
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXDrawing.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXDrawing.dll from the setup.

Description

The TXDrawingCore class provides properties and methods to specify the type and format of shapes rendered as a Scalable Vector Graphics (SVG). The class implements the System.ComponentModel.INotifyPropertyChanged interface. Changes to the shapes that require updating the view can be listend via the Changed event. The following describes only the properties, methods and events defined through the TXDrawingCore class. For a list of properties, methods and events inherited from the System.ComponentModel.INotifyPropertyChanged interface see the .NET Framework reference.

Syntax

public class TXDrawingCore

Examples

The following example creates a TXDrawing Core instance and configures its back color setting for a document workflow.

TXTextControl.Drawing.TXDrawingCore tXDrawingCore = new();
tXDrawingCore.BackColor = System.Drawing.Color.LightSteelBlue;

Members

Constructors

ConstructorDescription
TXDrawingCoreInitializes a new instance of the TXDrawingCore class.

Properties

PropertyDescription
BackColorGets or sets the back color of the canvas. The default value is System.Drawing.Transparent.
BorderColorGets or sets the border line color of the canvas. The default value is System.Drawing.Black.
BorderWidthGets or sets the border line width of the canvas. The value is given in twips. The default value is 0.
CanCopyInforms whether shapes are selected which can be copied to the internal clipboard.
CanPasteInforms whether the internal clipboard contains shapes that can be pasted into the canvas.
CanRedoInforms whether an operation can be re-done using the Redo method.
CanUndoGets a value indicating whether the user can undo the previous TXDrawingCore operation.
IsCanvasVisibleGets a value whether the cavas is visible or not. It is visible if it contains only one shape, the shape's CanFitToCanvas property is set to false, its AutoSize property is set to true and the TXDrawingCore's BorderWidth property is 0. If the property's value is false the TXDrawingCore instance can be thought of as a representation of the containing shape where bounds changes of the TXDrawingCore lead to considering changes of the shape and vise versa.
SelectionGets an object of type Drawing.Selection that represents the current selected shapes inside the canvas.
ShapesGets an object of type ShapeCollection that represents those shapes which are displayed inside the canvas.
SizeGets or sets the size of the canvas.

Methods

MethodDescription
ClearUndoClears the undo buffer of the TXDrawingCore instance.
CopyCopies the current selected shapes to the Clipboard.
CutMoves the current selected shapes to the Clipboard.
GetSVGCreates and returns a string representing a Scalable Vector Graphics (SVG) of the shapes.
LoadLoads shapes data into the canvas from a specified object of type System.IO.Stream.
PastePastes the content of the clipboard into the canvas.
RedoRedoes the last TXDrawingCore operation.
SaveSaves the shapes data to the given object of type System.IO.Stream.
SelectAllSelects all shapes.
SetCanvasSizeNot described in the reference. public void SetCanvasSize(double dNewWidth, double dNewHeight);
SizeToContentIf any changes of the the displayed shapes' visible bounds require an adaption of the canvas bounds, its size and/or location is expanded respectively decreased by the considering value of the considering shape's side(s). The method returns an array of doubles which represent the effected alteration for each canvas side (left, top, right, bottom) in Twips.
UndoUndoes the last TXDrawingCore's edit operation.

Events

EventDescription
AdaptBoundsIndicates that the visible bounds of the displayed shapes have been changed (by changing the shape's angle, outline width, yellow adjust rectangles or the canvas' border width) in so far that the canvas requires an update of its bounds. The event always raises if the visible bounds exceed the canvas' bounds. If IsCanvasVisible is false, AdaptBounds is also raised if considering changes lead to a decreasing of the visible shape bounds. The event handler receives an argument of type EventArgs containing data related to this event.
ChangedIndicates that the number or formatting of the displayed shapes has been changed. The event handler receives an argument of type EventArgs.
PropertyChangedNot described in the reference. public event PropertyChangedEventHandler PropertyChanged;
ShapeCreatedOccurs when a new shape has been created. It occurs, when a shape has been inserted in the TXDrawingCore's shapes collection by pasting or using the shape collection's Add method. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeDeletedOccurs when a shape has been deleted from the TXDrawingCore's shapes collection. It occurs by cutting or using the shape collection's Remove, RemoveAt or Clear method. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeDeselectedOccurs when a shape has been deselected. It occurs by removing a shape from the TXDrawingCore.Selection.Shapes property or, if the number of selected shapes is greater than 0, clicking on a location inside the canvas where no shape is located. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeFlippedOccurs when a shape has been flipped. It occurs by using the shape's Flip property. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeFormatChangedOccurs when shape formatting attributes have been changed. The corresponding attributes are the shape's ShapeFill, ShapeOutline are Type properties. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeMovedOccurs when a shape has been moved. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeSelectedOccurs when a shape has been selected. It occurs by using the select all method or changing the TXDrawingCore.Selection.Shapes property . The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ShapeSizedOccurs when a shape has been sized. The event handler receives an argument of type ShapeEventArgs containing data related to this event.
ViewChangedOccurs selection changing have caused the view to change. The event handler receives an argument of type ViewChangedEventArgs containing data related to this event.