c# - 如何使用.Net system.drawing.drawstring编写从右到左的字符串(项目是一个dll)?

标签 c# gdi+ right-to-left

嗨 我需要从字符串创建位图文件,目前我正在使用

Bitmap b = new Bitmap(106, 21);
Font f = new Font("Tahoma",5 );
StringFormat sf = new StringFormat();            
int faLCID = new System.Globalization.CultureInfo("fa-IR").LCID;
sf.SetDigitSubstitution(faLCID, StringDigitSubstitute.National);            
Brush brush = Brushes.Black;
Point pos = new Point(2, 2);
Graphics c = Graphics.FromImage(b);                        
c.FillRectangle(Brushes.White, 0, 0, m_width, m_length);
c.DrawString(stringText, f, brush, pos,sf);

它可以工作,但问题是它是从左到右书写的。如何使 DrawString() 从右向左书写? 感谢x

最佳答案

传递StringFormatFlags.DirectionRightToLeft

关于c# - 如何使用.Net system.drawing.drawstring编写从右到左的字符串(项目是一个dll)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4820593/

相关文章:

C# 程序集加载和后期绑定(bind)

c# - 我可以在没有这些工件的情况下使用 graphics.RotateTransform() 吗?

c# - 如何在特定边界内绘制具有可变宽度边框的圆角矩形

html - 对齐 RTL 语言的元素

c# - Entity Framework 6 Create() 与 new

c# - 如何检查连接是否打开

c# - 扩展 Win 7 (Aero) 绘制其默认窗口和控件的方式

c - 从 WinForms (GDI+) 迁移到 WPF 时如何替换 DrawClosedCurve/FillClosedCurve?

html - HTML 中从右到左的数字

android - textview不是从右到左虽然从右到左设备