Back to DOM
BaseGraphicElementClass
Definition
- Namespace
- DOM.Abstracts
- Assembly
- DOM.dll
Base class for graphical DOM elements.
Remarks
sits between and the concrete graphics types (images, shapes, fills, colors, effects, transforms). It exists so that all graphical elements share a common root that can be used for collections and polymorphic handling, while remaining distinguishable from non-graphic elements at compile time. BaseGraphicElement BaseElement The class adds no members of its own; all behaviour comes from (change tracking and cloning) plus the interface marker. BaseElement IBaseGraphicElement
Examples
csharp
1// 1. Store heterogeneous graphics in a list
2var graphics = new List<BaseGraphicElement>
3{
4 new Image("logo.png"),
5 new Shape { Type = ShapeType.Rectangle }
6};
7
csharp
1// 2. Cast to the marker interface
2BaseGraphicElement graphic = new Color("#FF0000");
3IBaseGraphicElement marker = graphic;
4
csharp
1// 3. Clone any graphic element generically
2BaseGraphicElement copy = (BaseGraphicElement)graphic.Clone();
3
csharp
1// 4. Type-check during rendering
2if (element is BaseGraphicElement g) { /* render graphics */ }
3
No members discovered for this type.