Source/TextDrawing.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Text;
#if DOTNETBAR
namespace DevComponents.DotNetBar
#else
namespace DevComponents.Tree
#endif
{
internal class TextDrawing
{
static TextDrawing()
{
string lc = Application.CurrentCulture.TwoLetterISOLanguageName;
if (lc == "ja" || lc == "ko" || lc == "zh" || lc == "ar")
UseGenericDefault = true;
}
public static bool TextDrawingEnabled = true;
public static bool UseTextRenderer = false;
public static void DrawString(Graphics g, string text, Font font, Color color, int x, int y, eTextFormat format)
{
DrawString(g, text, font, color, new Rectangle(x, y, 0, 0), format);
}
public static void DrawString(Graphics g, string text, Font font, Color color, Rectangle bounds, eTextFormat format)
{
#if FRAMEWORK20
if (UseTextRenderer && (format & eTextFormat.Vertical) == 0)
TextRenderer.DrawText(g, text, font, bounds, color, GetTextFormatFlags(format));
else
DrawStringLegacy(g, text, font, color, bounds, format);
#else
DrawStringLegacy(g, text, font, color, bounds, format);
#endif
}
public static void DrawStringLegacy(Graphics g, string text, Font font, Color color, Rectangle bounds, eTextFormat format)
{
if (color.IsEmpty || !TextDrawingEnabled)
return;
using(SolidBrush brush=new SolidBrush(color))
g.DrawString(text,font,brush,bounds,GetStringFormat(format));
}
public static Size MeasureString(Graphics g, string text, Font font)
{
return MeasureString(g, text, font, Size.Empty, eTextFormat.Default);
}
public static Size MeasureString(Graphics g, string text, Font font, int proposedWidth, eTextFormat format)
{
return MeasureString(g, text, font, new Size(proposedWidth, 0), format);
}
后面还有 172 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。