Class Element
- Namespace
- ConsoleAppVisuals.Models
- Assembly
- ConsoleAppVisuals.dll
The Element class is an abstract class that represents an element that can be rendered on the console.
public abstract class Element
- Inheritance
-
Element
- Derived
- Inherited Members
Remarks
For more information, consider visiting the documentation available here.
Constructors
Element()
protected Element()
Properties
Height
Gets the height of the element, the vertical number of lines taken in the console.
public virtual int Height { get; }
Property Value
Remarks
This property is marked as virtual. It is recommended to override this property in derived classes to make it more specific.
Id
Gets the id number of the element.
public int Id { get; set; }
Property Value
Remarks
This property is sealed. The ID of an element is automatically generated and managed by the Window class.
Line
Gets a line to place the element in the console.
public virtual int Line { get; }
Property Value
Remarks
ATTENTION: This property is not marked as virtual. Override this property only to give it a constant value.
Exceptions
- ArgumentOutOfRangeException
Thrown when the placement of the element is invalid.
MaxNumberOfThisElement
Gets the maximum number of this element that can be drawn on the console.
public virtual int MaxNumberOfThisElement { get; }
Property Value
Remarks
This property is marked as virtual. It is recommended to override this property in derived classes to make it more specific.
Placement
Gets the placement of the element int the console. See the Placement enum to know the possible values.
public virtual Placement Placement { get; set; }
Property Value
Remarks
This property is marked as virtual. It is recommended to override this property in derived classes to make it more specific.
TextAlignment
Gets the text alignment of the text of the element. See the TextAlignment enum to know the possible values.
public virtual TextAlignment TextAlignment { get; set; }
Property Value
Remarks
This property is marked as virtual. It is recommended to override this property in derived classes to make it more specific.
Type
Gets the type of the element.
[Visual]
public virtual ElementType Type { get; }
Property Value
Visibility
Gets the visibility of the element.
public bool Visibility { get; }
Property Value
Remarks
This property is sealed. The visibility of an element is managed by the ToggleVisibility() method.
Width
Gets the width of the element, the horizontal number of lines taken in the console.
public virtual int Width { get; }
Property Value
Remarks
This property is marked as virtual. It is recommended to override this property in derived classes to make it more specific.
Methods
Clear()
Clears the space taken by the element on the console.
[Visual]
public void Clear()
Remarks
For more information, consider visiting the documentation available here.
GetRenderSpace()
Gets the space taken by the element on the console.
[Visual]
protected virtual string[] GetRenderSpace()
Returns
- string[]
The space taken by the element.
Remarks
This method is marked as virtual. It is recommended to override this method in derived classes to make it more specific.
RenderElement()
Renders the element on the console.
[Visual]
public void RenderElement()
Remarks
For more information, consider visiting the documentation available here.
RenderElementActions()
Defines the actions to perform when the element is called to be rendered on the console.
[Visual]
protected virtual void RenderElementActions()
Remarks
This method is marked as virtual. It is recommended to override this method in derived classes to make it more specific.
RenderElementSpace(bool)
Renders the space taken by the element on the console.
[Visual]
public void RenderElementSpace(bool ignoreVisibility = false)
Parameters
ignoreVisibility
boolWhether to ignore the visibility of the element or not.
Remarks
For more information, consider visiting the documentation available here.
RenderOptionsAfterHand()
Defines actions to perform after rendering the element on the console.
[Visual]
protected virtual void RenderOptionsAfterHand()
RenderOptionsBeforeHand()
Defines actions to perform before rendering the element on the console.
[Visual]
protected virtual void RenderOptionsBeforeHand()
ToggleVisibility()
Toggles the visibility of the element. If the maximum number of this element is reached, an exception is thrown.
public void ToggleVisibility()
Remarks
This method is effectively sealed. The only way to change the visibility of an element is to use this method.
Exceptions
- InvalidOperationException
Thrown when the maximum number of this element is reached.