سؤال

I have some code to draw some text:

 var textFormat = new SharpDX.DirectWrite.TextFormat(fontFactory, "Arial", SharpDX.DirectWrite.FontWeight.Bold, 
        SharpDX.DirectWrite.FontStyle.Normal, SharpDX.DirectWrite.FontStretch.Condensed, 16.0f);
    renderTarget.DrawText("AC", textFormat, textRect, textBrush, DrawTextOptions.NoSnap);

The text is drawn starting at the top-left of the target rectangle. Is there any way to right-justify the text?

هل كانت مفيدة؟

المحلول

The fourth entry for the google search "right justify text sharpdx direct2d" shows me the documentation of the TextFormat class, which has the property TextAlignment. Sometimes a little search is faster then to use Stackoverflow ;)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top