New to Telerik UI for WinForms? Start a free 30-day trial

Renders and measures plain text using the WinForms text renderer or compatible GDI+ rendering.

Definition

Namespace:Telerik.WinControls.Primitives

Assembly:Telerik.WinControls.dll

Syntax:

C#
public class TextPrimitiveImpl : ITextPrimitive

Inheritance: objectTextPrimitiveImpl

Implements: ITextPrimitive

Constructors

C#
public TextPrimitiveImpl()

Methods

Builds WinForms text-format flags from alignment, direction, mnemonic, keyboard-cue, ellipsis, and wrapping settings.

C#
public TextFormatFlags CreateTextFormatFlags(TextParams textParams)
Parameters:textParamsTextParams

The text settings used to construct the flags.

Returns:

TextFormatFlags

The flags passed to WinForms text measurement and drawing.

Measures text with the legacy layout sizing option.

C#
public SizeF GetTextSize(SizeF proposedSize, bool autoFitInProposedSize, TextParams textParams)
Parameters:proposedSizeSizeF

The proposed size used when autoFitInProposedSize is true.

autoFitInProposedSizebool

true to measure within the proposed size; otherwise, measure without its width constraint.

textParamsTextParams

The text content and formatting settings.

Returns:

SizeF

The measured size.

Measures text using the supplied proposed size as a constraint.

C#
public SizeF GetTextSize(SizeF proposedSize, TextParams textParams)
Parameters:proposedSizeSizeF

The size available for measuring the text.

textParamsTextParams

The text content and settings that affect measurement.

Returns:

SizeF

The measured size of the text.

Implements: ITextPrimitive.GetTextSize(SizeF, TextParams)

Retrieves the text size.

C#
public SizeF GetTextSize(TextParams textParams)
Parameters:textParamsTextParamsReturns:

SizeF

Implements: ITextPrimitive.GetTextSize(TextParams)

Measures element text through the Direct2D graphics service when available; otherwise uses this renderer's normal measurement path.

C#
public SizeF MeasureOverride(SizeF availableSize, TextParams textParams, ITextElement element)
Parameters:availableSizeSizeF

The size available to the text.

textParamsTextParams

The text settings used by the normal measurement path.

elementITextElement

The text element passed to the Direct2D measurement service.

Returns:

SizeF

The desired size of the text, adjusted for vertical orientation.

Measures the desired text size within the available layout size.

C#
public SizeF MeasureOverride(SizeF availableSize, TextParams textParams)
Parameters:availableSizeSizeF

The maximum size available to the text.

textParamsTextParams

The text content and settings that affect measurement.

Returns:

SizeF

The desired size of the rendered text.

Implements: ITextPrimitive.MeasureOverride(SizeF, TextParams)

Ignores pointer movement because the plain-text renderer has no interactive text content.

C#
public void OnMouseMove(object sender, MouseEventArgs e)
Parameters:senderobject

The object associated with the pointer event.

eMouseEventArgs

The mouse-event data.

Implements: ITextPrimitive.OnMouseMove(object, MouseEventArgs)

Paints text using the supplied graphics context and parameters. The built-in backends do not apply the supplied angle and scale.

C#
public void PaintPrimitive(IGraphics graphics, float angle, SizeF scale, TextParams textParams)
Parameters:graphicsIGraphics

The graphics context used to draw the text.

anglefloat

The rotation angle supplied for the paint operation.

scaleSizeF

The scale supplied for the paint operation.

textParamsTextParams

The text content, layout, and rendering settings.

Implements: ITextPrimitive.PaintPrimitive(IGraphics, float, SizeF, TextParams)

Paints text using the supplied text parameters without an explicit transform.

C#
public void PaintPrimitive(IGraphics graphics, TextParams textParams)
Parameters:graphicsIGraphics

The graphics context used to draw the text.

textParamsTextParams

The text content, layout, and rendering settings.

Implements: ITextPrimitive.PaintPrimitive(IGraphics, TextParams)

Mirrors the horizontal component of a text alignment when right-to-left layout is enabled.

C#
public ContentAlignment RtlContentAlignment(TextParams textParams)
Parameters:textParamsTextParams

The text settings containing alignment and direction.

Returns:

ContentAlignment

The alignment to use for the current text direction.