Ehs*_*bar 0 .net c# graphics drawing
我想使用DrawString在我的图形实例中编写一个垂直文本.
我的代码是这样的:
var graph = Graphics.FromImage(map);
Run Code Online (Sandbox Code Playgroud)
我从数据库中读到了文本及其位置:
graph.DrawString(ObjStationRepository.FindBy(i => i.Id == t.StationId).First().Description, new Font("B Nazanin", 18), Brushes.White, t.XLocation + 70, t.YLocation +80);
Run Code Online (Sandbox Code Playgroud)
但我的问题是,我需要将文本写入垂直位置而不是水平.但DrawString在水平方向写入文本!!
最好的祝福
使用
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat();
drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
Run Code Online (Sandbox Code Playgroud)
并将其添加为最后一个参数 DrawString