TXDrawingCore Class
- Namespace
TXTextControl.Drawing
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXDrawing.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXDrawing.from the setup.dll
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 TXDrawingCorePublic Class TXDrawingCoreExamples
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;Dim tXDrawingCore As New TXTextControl.Drawing.TXDrawingCore()
tXDrawingCore.BackColor = System.Drawing.Color.LightSteelBlueMembers
Constructors
| Constructor | Description |
|---|---|
| TXDrawingCore | Initializes a new instance of the TXDrawingCore class. |
Properties
| Property | Description |
|---|---|
| BackColor | Gets or sets the back color of the canvas. The default value is System.Drawing.Transparent. |
| BorderColor | Gets or sets the border line color of the canvas. The default value is System.Drawing.Black. |
| BorderWidth | Gets or sets the border line width of the canvas. The value is given in twips. The default value is 0. |
| CanCopy | Informs whether shapes are selected which can be copied to the internal clipboard. |
| CanPaste | Informs whether the internal clipboard contains shapes that can be pasted into the canvas. |
| CanRedo | Informs whether an operation can be re-done using the Redo method. |
| CanUndo | Gets a value indicating whether the user can undo the previous TXDrawingCore operation. |
| IsCanvasVisible | Gets 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. |
| Selection | Gets an object of type Drawing.Selection that represents the current selected shapes inside the canvas. |
| Shapes | Gets an object of type ShapeCollection that represents those shapes which are displayed inside the canvas. |
| Size | Gets or sets the size of the canvas. |
Methods
| Method | Description |
|---|---|
| ClearUndo | Clears the undo buffer of the TXDrawingCore instance. |
| Copy | Copies the current selected shapes to the Clipboard. |
| Cut | Moves the current selected shapes to the Clipboard. |
| GetSVG | Creates and returns a string representing a Scalable Vector Graphics (SVG) of the shapes. |
| Load | Loads shapes data into the canvas from a specified object of type System.IO.Stream. |
| Paste | Pastes the content of the clipboard into the canvas. |
| Redo | Redoes the last TXDrawingCore operation. |
| Save | Saves the shapes data to the given object of type System.IO.Stream. |
| SelectAll | Selects all shapes. |
| SetCanvasSize | Not described in the reference. public void SetCanvasSize(double dNewWidth, double dNewHeight); |
| SizeToContent | If 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. |
| Undo | Undoes the last TXDrawingCore's edit operation. |
Events
| Event | Description |
|---|---|
| AdaptBounds | Indicates 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. |
| Changed | Indicates that the number or formatting of the displayed shapes has been changed. The event handler receives an argument of type EventArgs. |
| PropertyChanged | Not described in the reference. public event PropertyChangedEventHandler PropertyChanged; |
| ShapeCreated | Occurs 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. |
| ShapeDeleted | Occurs 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. |
| ShapeDeselected | Occurs 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. |
| ShapeFlipped | Occurs 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. |
| ShapeFormatChanged | Occurs 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. |
| ShapeMoved | Occurs when a shape has been moved. The event handler receives an argument of type ShapeEventArgs containing data related to this event. |
| ShapeSelected | Occurs 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. |
| ShapeSized | Occurs when a shape has been sized. The event handler receives an argument of type ShapeEventArgs containing data related to this event. |
| ViewChanged | Occurs selection changing have caused the view to change. The event handler receives an argument of type ViewChangedEventArgs containing data related to this event. |