Gdiplus.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Drawing;
  3. using System.Runtime.InteropServices;
  4. namespace Microsoft.Win32
  5. {
  6. /// <summary>
  7. /// Gdiplus.dll
  8. /// </summary>
  9. public static partial class UnsafeNativeMethods
  10. {
  11. /// <summary>
  12. /// 测试字符串大小
  13. /// </summary>
  14. /// <param name="hGraphics">绘图对象句柄</param>
  15. /// <param name="szText">要测试的字符串</param>
  16. /// <param name="nLength">字符串长度</param>
  17. /// <param name="hFont">字体句柄</param>
  18. /// <param name="aPositions">坐标数组</param>
  19. /// <param name="nFlags">标记</param>
  20. /// <param name="hMatrix"></param>
  21. /// <param name="tBounds">区域</param>
  22. /// <returns></returns>
  23. [DllImport("gdiplus.dll", CharSet = CharSet.Auto)]
  24. public extern static int GdipMeasureDriverString(IntPtr hGraphics, string szText, int nLength, IntPtr hFont, PointF[] aPositions, int nFlags, IntPtr hMatrix, ref RectangleF tBounds);
  25. /// <summary>
  26. /// 绘制字符串
  27. /// </summary>
  28. /// <param name="hGraphics">绘图对象</param>
  29. /// <param name="szText">要绘制的文本</param>
  30. /// <param name="nLength">字符串长度</param>
  31. /// <param name="hFont">字体句柄</param>
  32. /// <param name="hBrush">画刷句柄</param>
  33. /// <param name="aPositions">坐标数组</param>
  34. /// <param name="nFlags">标记</param>
  35. /// <param name="hMatrix">向量矩阵</param>
  36. /// <returns></returns>
  37. [DllImport("gdiplus.dll", CharSet = CharSet.Auto)]
  38. public extern static int GdipDrawDriverString(IntPtr hGraphics, string szText, int nLength, IntPtr hFont, IntPtr hBrush, PointF[] aPositions, int nFlags, IntPtr hMatrix);
  39. }
  40. }