using System; using System.Drawing; using System.Runtime.InteropServices; namespace Microsoft.Win32 { /// /// Gdiplus.dll /// public static partial class UnsafeNativeMethods { /// /// 测试字符串大小 /// /// 绘图对象句柄 /// 要测试的字符串 /// 字符串长度 /// 字体句柄 /// 坐标数组 /// 标记 /// /// 区域 /// [DllImport("gdiplus.dll", CharSet = CharSet.Auto)] public extern static int GdipMeasureDriverString(IntPtr hGraphics, string szText, int nLength, IntPtr hFont, PointF[] aPositions, int nFlags, IntPtr hMatrix, ref RectangleF tBounds); /// /// 绘制字符串 /// /// 绘图对象 /// 要绘制的文本 /// 字符串长度 /// 字体句柄 /// 画刷句柄 /// 坐标数组 /// 标记 /// 向量矩阵 /// [DllImport("gdiplus.dll", CharSet = CharSet.Auto)] public extern static int GdipDrawDriverString(IntPtr hGraphics, string szText, int nLength, IntPtr hFont, IntPtr hBrush, PointF[] aPositions, int nFlags, IntPtr hMatrix); } }