我有一些代码来绘制一些文字:
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);
从目标矩形的左上角开始绘制文本。有没有办法对文本进行右对齐?
答案 0 :(得分:1)
谷歌搜索的第四个条目“右对齐文本sharpdx direct2d”向我显示TextFormat
类的documentation,其中包含属性TextAlignment
。有时一点点搜索比使用Stackoverflow更快;)