ToDirectWriteTextFormat()

View as Markdown

Definition

Converts a SimpleFont object to a SharpDX compatible font which can be used for chart rendering.

For more information please see the educational resource on Using SharpDX for Custom Chart Rendering.

Method Return Value

A DirectWrite.TextFormat object

The returned DirectWrite.TextFormat object should be disposed of immediately when finished drawing text.

Syntax

\<simplefont\>.ToDirectWriteTextFormat()

Examples

protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
// Set text to chart label simple font object
SharpDX.DirectWrite.TextFormat textFormat = chartControl.Properties.LabelFont.ToDirectWriteTextFormat();
// use the textFormat in a RenderTarget.DrawText() or DrawTextLayout() method
// do not forget to dispose text format when finished
textFormat.Dispose();
}