TextStylePreview Class
Represents a syntax-highlighting code editor control.
[ToolboxBitmap(typeof(TextStylePreview))]
public class TextStylePreview : UIControl, IUIControl, IUIElement, ILogicalTreeNode, IDpiAwareElement, IDisposable
- Inheritance:
- object MarshalByRefObject Component Control ScrollableControl UIControl object
- Implements:
- IUIControl IUIElement ILogicalTreeNode IDpiAwareElement IDisposable
Constructors
TextStylePreview()
Initializes an instance of the class.
public TextStylePreview()
Properties
BackColor
Gets or sets the background color for the control.
public override Color BackColor { get; set; }
Property Value
- Color:
A Color that represents the background color of the control. The default is the value of the DefaultBackColor property.
DefaultSize
Gets the default size of the control.
Font
Gets or sets the font of the text displayed by the control.
public override Font Font { get; set; }
Property Value
- Font:
The Font to apply to the text displayed by the control. The default is the value of the DefaultFont property.
ForeColor
Gets or sets the foreground color of the control.
public override Color ForeColor { get; set; }
Property Value
- Color:
The foreground Color of the control. The default is the value of the DefaultForeColor property.
HighlightingStyle
The IHighlightingStyle to apply to the preview.
HighlightingStyleRegistry
The optional alternate IHighlightingStyleRegistry to use.
public IHighlightingStyleRegistry? HighlightingStyleRegistry { get; set; }
Property Value
Remarks
If this property is null, the AmbientHighlightingStyleRegistry will be used.
Padding
The padding for the control.
Text
The text to preview.
public override string Text { get; set; }
Property Value
- string:
The default value is
ij = I::oO(0xB81l);.
Methods
ArrangeOverride(Size)
Positions child elements and determines an arrange size.
protected override Size ArrangeOverride(Size finalSize)
| Parameter | Type | Description |
|---|---|---|
| finalSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
Remarks
Element authors should override this method, call Arrange(Rectangle) on each visible child element and position each child element. It is required that a parent element calls Arrange(Rectangle) on each child or they won't be rendered.
CreateChildren()
Invoked when the collection of child elements is to be created.
protected override IList<ILogicalTreeNode>? CreateChildren()
Returns
- IList<ILogicalTreeNode>:
The list that should be assigned to the Children property.
Remarks
By default, no child collection is created.
MeasureOverride(Graphics?, Size)
Measures the size in layout required for child elements and determines a size for the element itself.
protected override Size MeasureOverride(Graphics? g, Size availableSize)
| Parameter | Type | Description |
|---|---|---|
| g | Graphics | The Graphics object to use for measurement. |
| availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
Remarks
Element authors should override this method, call Measure(Graphics?, Size) on each visible child element and determine the total size required.
OnDraw(CanvasDrawEventArgs)
Occurs when the canvas should be rendered.
protected virtual void OnDraw(CanvasDrawEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CanvasDrawEventArgs | The event data. |
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event.
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | PropertyChangedEventArgs | The event data. |
OnPropertyChanged(string?)
Raises the PropertyChanged event.
protected void OnPropertyChanged(string? propertyName = null)
| Parameter | Type | Description |
|---|---|---|
| propertyName | string | (Optional) The name of the property that changed. |
ResetBackColor()
Resets the BackColor property to its default value.
public override void ResetBackColor()
ResetFont()
Resets the Font property to its default value.
public override void ResetFont()
ResetForeColor()
Resets the ForeColor property to its default value.
public override void ResetForeColor()
ResetPadding()
Resets the Padding property to its default value.
public virtual void ResetPadding()
ResetTabStop()
Resets the TabStop property to its default value.
public virtual void ResetTabStop()
SetProperty<T>(ref T, T, string?)
Called from a property setter to change the backing field's value and raise PropertyChanged notification events if the new value is not equal to the current value.
protected bool SetProperty<T>(ref T field, T newValue, string? propertyName = null)
- Type Parameters:
-
T-The type of the property that changed.
| Parameter | Type | Description |
|---|---|---|
| field | T | The backing field that holds the property's value, which may be updated. |
| newValue | T | The new property value. |
| propertyName | string | (Optional) The name of the property that changed. |
Returns
- bool:
trueif the property was changed; otherwise,false.
ShouldSerializeBackColor()
Indicates whether the BackColor property should be persisted.
protected virtual bool ShouldSerializeBackColor()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeFont()
Indicates whether the Font property should be persisted.
protected virtual bool ShouldSerializeFont()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeForeColor()
Indicates whether the ForeColor property should be persisted.
protected virtual bool ShouldSerializeForeColor()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializePadding()
Indicates whether the Padding property should be persisted.
protected virtual bool ShouldSerializePadding()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeTabStop()
Indicates whether the TabStop property should be persisted.
protected virtual bool ShouldSerializeTabStop()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
Events
PropertyChanged
Occurs when a property value changes.
Inherited Members
- UIControl.Dispose(bool)
- UIControl.AddPendingGraphicsInversion(Rectangle)
- UIControl.AddPendingScrollOperation(Rectangle, Orientation, int)
- UIControl.AddPendingScrollOperation(Rectangle, int, int)
- UIControl.AddToInvalidatedRegion()
- UIControl.AddToInvalidatedRegion(Rectangle)
- UIControl.Arrange(Rectangle)
- UIControl.ContainsLocation(Point)
- UIControl.DpiScaleChanged(SizeF)
- UIControl.GetCursor(Point)
- UIControl.HitTest(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, bool>)
- UIControl.HitTestRecursive(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, bool>)
- UIControl.Invalidate(InvalidationLevels, InvalidationTypes)
- UIControl.InvalidateArrange()
- UIControl.InvalidateMeasure()
- UIControl.Measure(Graphics, Size)
- UIControl.OnClick(EventArgs)
- UIControl.OnDoubleClick(EventArgs)
- UIControl.OnDpiChangedAfterParent(EventArgs)
- UIControl.OnHandleCreated(EventArgs)
- UIControl.OnLayout(LayoutEventArgs)
- UIControl.OnLocationChanged(EventArgs)
- UIControl.OnMouseCaptureChanged(EventArgs)
- UIControl.OnMouseDown(MouseEventArgs)
- UIControl.OnMouseEnter(EventArgs)
- UIControl.OnMouseHover(EventArgs)
- UIControl.OnMouseLeave(EventArgs)
- UIControl.OnMouseMove(MouseEventArgs)
- UIControl.OnMouseUp(MouseEventArgs)
- UIControl.OnMouseWheel(MouseEventArgs)
- UIControl.OnPaint(PaintEventArgs)
- UIControl.OnPaintBackground(PaintEventArgs)
- UIControl.OnParentChanged()
- UIControl.OnParentChanged(EventArgs)
- UIControl.OnRender(PaintEventArgs)
- UIControl.OnRenderChildElements(PaintEventArgs)
- UIControl.OnResize(EventArgs)
- UIControl.OnRightToLeftChanged(EventArgs)
- UIControl.OnVisibleChanged(EventArgs)
- UIControl.Render(PaintEventArgs)
- UIControl.ResetDoubleBufferCanvas(bool)
- UIControl.ResumePainting()
- UIControl.SuspendPainting()
- UIControl.TransformToAncestor(IUIElement)
- UIControl.TransformToDescendant(IUIElement)
- UIControl.UpdateCursor()
- UIControl.UpdateCursor(Point)
- UIControl.UpdateLayout()
- UIControl.ActualHeight
- UIControl.ActualWidth
- UIControl.BackgroundImage
- UIControl.CaptureMouseWhenPressed
- UIControl.ClipBounds
- UIControl.DesiredSize
- UIControl.DpiScaleFactor
- UIControl.IsArrangeValid
- UIControl.IsMeasureValid
- UIControl.IsPaintValid
- UIControl.IsRightToLeft
- UIControl.LastMouseUpButton
- UIControl.PaintingSuspended
- UIControl.UseControlGraphicsForMeasure
- UIControl.UseExtendedDoubleBuffering
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()