In This Article

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 TextStylePreview 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.

DefaultSize

Gets the default size of the control.

protected override Size DefaultSize { get; }

Property Value

Size:

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 object to apply to the text displayed by the control.

ForeColor

Gets or sets the foreground color for the control.

public override Color ForeColor { get; set; }

Property Value

Color:

A Color that represents the foreground color of the control.

HighlightingStyle

Gets or sets the IHighlightingStyle to apply to the preview.

public IHighlightingStyle HighlightingStyle { get; set; }

Property Value

IHighlightingStyle:

The IHighlightingStyle to apply to the preview.

HighlightingStyleRegistry

Gets or sets the optional alternate IHighlightingStyleRegistry to use.

public IHighlightingStyleRegistry HighlightingStyleRegistry { get; set; }

Property Value

IHighlightingStyleRegistry:

The optional alternate IHighlightingStyleRegistry to use.

Remarks

If this property is null, the AmbientHighlightingStyleRegistry will be used.

Padding

Gets or sets the padding for the control.

public Padding Padding { get; set; }

Property Value

Padding:

A Padding that represents the padding of the control.

Text

Gets or sets the text to preview.

public override string Text { get; set; }

Property Value

string:

The text to preview. The default value is AaBbCcXxYyZz.

Methods

ArrangeOverride(Size)

Positions child elements and returns the element's size.

protected override Size ArrangeOverride(Size finalSize)
Parameter Type Description
finalSize Size

The size within the parent that this element should use to arrange itself and its children.

Returns

Size:

The actual size used.

CreateChildren()

Invoked when the collection of child elements is to be created.

protected override IList CreateChildren()

Returns

IList:

The IList that should be assigned to the Children property.

Remarks

By default no child collection is created.

MeasureOverride(Graphics, Size)

Measures the size required for the element and its child elements.

protected override Size MeasureOverride(Graphics g, Size availableSize)
Parameter Type Description
g Graphics

The Graphics to use for measurement.

availableSize Size

The available size.

Returns

Size:

The desired size.

NotifyPropertyChanged(string)

Notifies that a property has changed.

protected void NotifyPropertyChanged(string propertyName)
Parameter Type Description
propertyName string

The name of the property that was changed.

OnDraw(CanvasDrawEventArgs)

Occurs when the canvas should be rendered.

protected virtual void OnDraw(CanvasDrawEventArgs e)
Parameter Type Description
e CanvasDrawEventArgs

The CanvasDrawEventArgs that contains data related to this event.

OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event.

protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameter Type Description
e PropertyChangedEventArgs

The PropertyChangedEventArgs that contains the event data.

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()

ShouldSerializeBackColor()

Indicates whether the BackColor property should be persisted.

protected virtual bool ShouldSerializeBackColor()

Returns

bool:

true if 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:

true if 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:

true if 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:

true if 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:

true if the property value has changed from its default; otherwise, false.

Events

PropertyChanged

Occurs when a property has been changed.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler

Inherited Members