ToDirectWriteTextFormat()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > SimpleFont >

ToDirectWriteTextFormat()

Previous page Return to chapter overview Next page

Definition

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

 

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

 

 

Method Return Value

A DirectWrite.TextFormat object

 

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

 

 

Syntax

<SimpleFont>.ToDirectWriteTextFormat()

 

 

Examples

ns


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