[]
Base class for all elements, handles layout and styles. Instances of this class have no content and no children.
Elements with content (and no children) derive from ContentElement.
Elements with children derive from BasePanel.
This class doesn't do much by itself except call virtual methods that can be overridden in derived classes. It can draw a background and borders with no content, so it can be used to implement things like bars and spacers.
It is designed to be very light-weight, since typical documents may create thousands of these. Additional elements should be added to not-so-common derived classes.
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Element : ISupportUia
Name | Description |
---|---|
Element() | Creates a new instance of an Element. |
Element(Style) | Creates a new instance of an Element. |
Name | Description |
---|---|
_bounds | The Rectangle that defines the position of the Element within its parent. |
_flags | An Element.ElementFlags value that defines the behavior of this Element. |
_parent | The parent Element. |
_style | The Style object that defines the appearance of this Element. |
Name | Description |
---|---|
AutoHeight | Gets or sets the bool value specifying whether element height is automatically determined by its style and contents. |
AutoSize | Gets the bool value specifying whether element size is automatically determined by its style and contents. |
AutoWidth | Gets or sets the bool value specifying whether element width is automatically determined by its style and contents. |
Bounds | Gets or sets the element's bounds (size and location) within its parent element, in pixels. |
Children | Gets a list of child elements. |
ContainsFocus | Gets a value that indicates whether this Element or one of its children has the focus. |
ContentBounds | Client rectangle, in pixels. This discounts margins, borders, and padding. |
Enabled | Gets or sets whether the element is enabled (can receive mouse and keyboard messages). |
Focusable | Gets or sets whether the element is focusable (receives keyboard messages). |
Focused | Gets a value that indicates whether this Element has the focus. |
ForceLineBreak | Gets a Element.LineBreak value that determines whether there should be line breaks before and/or after this Element when it occurs in a paragraph. |
HasChildren | Gets a value that indicates the element has a non-empty Children collection. |
Height | Element height. Set to -1 to let the element calculate it automatically. |
HitTestable | Gets or sets whether the element is hit-testable (receives mouse messages). |
HostControl | |
HostView | |
HostedControl | Gets the Control that is hosted in this element. |
InheritedRtl | Gets or sets whether the value of RightToLeft property is inherited from the parent element. |
IsDirty | Gets a value that indicates this element needs to be laid out. |
IsEnabled | Gets whether this element and all its ancestors are enabled. |
IsFocusable | Gets whether this element can currently receive the focus. |
IsHot | Gets or sets whether the element should be displayed using the Style.Hot style. |
IsPressed | Gets or sets whether the element should be displayed using the Style.Pressed style. |
IsVisible | Gets whether this element and all its ancestors are visible. |
Left | Gets or sets the horizontal position of the element within its parent. |
LineDescent | Gets the portion of the element that renders below the baseline. Usually non-zero only for text elements, depends on font. |
Location | Gets or sets the location of the element within its parent. |
Parent | Gets the element's parent, or null if this is the root element. |
RenderStyle | Gets the element's style, or a default style if the element doesn't have one. This never returns null. |
RightToLeft | Gets or sets whether the element should be drawn using right-to-left layout. |
Root | Gets the element's top-level parent. |
ShowFocusRectangle | Gets or sets whether the element should display a focus rectangle when it has focus. |
Size | Gets or sets the size of the element. |
Style | Gets or sets the Style object used to render this Element. |
SuppressEvents | Gets or sets events supression. |
Top | Gets or sets the vertical position of the element within its parent. |
Validated | Gets or sets a value indicating if the contents was successfully validated. |
Visible | Gets or sets whether the element is visible. |
Width | Element width. Set to -1 to let the element calculate it automatically. |
Name | Description |
---|---|
ApplicationHasFocus(bool) | |
Clone() | Returns a clone of this element. |
FinalizeUI() | Finalizes the user interface. This method is called when element is removed from UI. |
FindMnemonic(Element, char) | Finds the Element that is represented by a given hot key. |
Focus() | Sets the focus to the host control and to this Element within the host control. |
GetBitmapResource(string) | Gets a Bitmap from the application's embedded resources. |
GetBorderPath(Style, Rectangle, Thickness) | Gets a GraphicsPath that covers only the borders (hollow, used to renders the borders). |
GetBounds(Element) | Gets the element's bounds (size and location) within an arbitrary ancestor, in pixels. Ancestor element (parent, grand-parent, etc).ancestor . |
GetBounds(Element, bool, bool) | Gets the element's bounds (size and location) within an arbitrary ancestor, in pixels. |
GetDeviceDPI() | Gets the DPI value for the display device where the HostControl is currently being displayed. |
GetFlags(ElementFlags) | |
GetImageResource(string) | Gets an Image from the application's embedded resources. |
GetParentOfType(Type) | Navigates up the tree to find an ancestor of a given type. |
GetParent<T>() | Navigates up the tree to find an ancestor of a given type. |
GetScrollOrigin() | Returns the scroll origin (override to implement non-scrolling areas). |
HitTest(Point) | Returns the element at a given point. |
Invalidate() | Invalidates this Element within the host control. |
Invalidate(bool) | Invalidates this Element within the host control. |
IsChildOf(Element) | Determines whether this element is a child of another element. |
IsInputKey(Keys) | Determines whether the specified key is a regular input key or a special key that requires preprocessing. |
Layout() | Perform layout using host control's Graphics object. |
Layout(Graphics) | Lays out this element based on its style and contents. |
Measure(Style, Graphics, object) | Provides the size, in pixels, of the specified content drawn on the specified Graphics surface with the specified style. |
Measure(Style, Graphics, object, int) | Provides the size, in pixels, of the specified content drawn on the specified Graphics surface within the rectangle of the specified width with the specified style settings. |
Measure(Graphics, object) | Provides the size, in pixels, of the specified content drawn on the specified Graphics surface. |
Measure(Graphics, object, int) | Provides the size, in pixels, of the specified content drawn on the specified Graphics surface within the rectangle of the specified width. |
Offset(int, int) | Adjusts the location of this element by the specified amount. |
OnBoundsChanged(Rectangle, Rectangle) | Called when Bounds changed. |
OnClick(EventArgs) | Called by the host control when the user clicks this Element. |
OnDoubleClick(EventArgs) | Called by the host control when the user double-clicks this Element. |
OnGotFocus(EventArgs) | Called by the host control when this Element receives the focus. |
OnKeyDown(KeyEventArgs) | Called by the host control when the user presses a key and this Element has the focus. |
OnKeyPress(KeyPressEventArgs) | Called by the host control when the user presses a character key and this Element has the focus. |
OnKeyUp(KeyEventArgs) | Called by the host control when the user releases a key and this Element has the focus. |
OnLostFocus(EventArgs) | Called by the host control when this Element loses the focus. |
OnMouseDown(MouseEventArgs) | Called by the host control when the user presses a mouse button over this Element. |
OnMouseEnter(EventArgs) | Called by the host control when the mouse enters this Element. |
OnMouseEnterHover(EventArgs) | Called by the host control when the mouse enters this Element, even if another element has captured the mouse. |
OnMouseLeave(EventArgs) | Called by the host control when the mouse leaves this Element. |
OnMouseLeaveHover(EventArgs) | Called by the host control when the mouse leaves this Element, even if another element has captured the mouse. |
OnMouseLostCapture(MouseEventArgs) | Called by the host control when the user releases the left mouse button over a disabled Element. |
OnMouseMove(MouseEventArgs) | Called by the host control when the mouse moves over this Element. |
OnMouseUp(MouseEventArgs) | Called by the host control when the user releases a mouse button over this Element. |
OnMouseWheel(MouseEventArgs) | Handles MouseWheel events. |
OnRightToLeftChanged() | |
OnStateChanged(ElementFlags) | Called by the host control when the state of this Element changes. |
OnValidated(EventArgs) | Called by the host control after the element has been validated. |
OnValidating(CancelEventArgs) | Called by the host control when the element is about to lose focus. |
PointToClient(Point) | Computes the location of the specified screen point into client coordinates. |
PointToScreen(Point) | Computes the location of the specified client point into screen coordinates. |
RaiseGotFocus(EventArgs) | Raises the GotFocus event. |
RaiseLostFocus(EventArgs) | Raises the LostFocus event. |
Render(Graphics, Rectangle) | Renders the element into a given rectangle. |
RenderChildren(Graphics, Rectangle) | Renders the child elements into a given rectangle. |
RenderContent(Graphics, Rectangle) | Render this element's content (no children). |
RescaleConstantsForDpi(int, int) | Provides constants for rescaling the Element when a DPI change occurs. |
ScaleToDeviceDPI(Style) | Scales the Style instance uses the DeviceDpi value if this element has a HostControl. |
ScaleToDeviceDPI(Thickness) | Scales a value uses the DeviceDpi value if this element has a HostControl. |
ScaleToDeviceDPI(Size) | Scales a value uses the DeviceDpi value if this element has a HostControl. |
ScaleToDeviceDPI(int) | Scales a value uses the DeviceDpi value if this element has a HostControl. |
SetDirty() | Marks this element as dirty, forcing all parent and child elements to be laid out. |
SetDirty(bool) | Marks this element as dirty, forcing all parent and child elements to be laid out. |
SetDirty(bool, bool) | Marks this element as dirty, forcing all parent and child elements to be laid out. |
SetFlags(ElementFlags, bool) | |
SetFlags(ElementFlags, bool, bool) | |
ThreadHasFocus(IntPtr) | |
UpdateStyle(DynamicStyle, Element) |
Name | Description |
---|---|
BoundsChanged | Occurs when the element bounds changed. |
EnabledChanged | Occurs when the enabled property changed. |
GotFocus | Occurs when the element got focus. |
LostFocus | Occurs when the element lost focus. |
VisibleChanged | Occurs when the visible property changed. |