public static int DrawText(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat) { if (Marshal.SystemDefaultCharSize == 1) { lpRect.top = Math.Min(0x7fff, lpRect.top); lpRect.left = Math.Min(0x7fff, lpRect.left); lpRect.right = Math.Min(0x7fff, lpRect.right); lpRect.bottom = Math.Min(0x7fff, lpRect.bottom); int num2 = WideCharToMultiByte(0, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero); byte[] pOutBytes = new byte[num2]; WideCharToMultiByte(0, 0, text, text.Length, pOutBytes, pOutBytes.Length, IntPtr.Zero, IntPtr.Zero); num2 = Math.Min(num2, 0x2000); return DrawTextA(hDC, pOutBytes, num2, ref lpRect, nFormat); } return DrawTextW(hDC, text, text.Length, ref lpRect, nFormat); }
public LOGFONT(IntNativeMethods.LOGFONT lf) { this.lfHeight = lf.lfHeight; this.lfWidth = lf.lfWidth; this.lfEscapement = lf.lfEscapement; this.lfOrientation = lf.lfOrientation; this.lfWeight = lf.lfWeight; this.lfItalic = lf.lfItalic; this.lfUnderline = lf.lfUnderline; this.lfStrikeOut = lf.lfStrikeOut; this.lfCharSet = lf.lfCharSet; this.lfOutPrecision = lf.lfOutPrecision; this.lfClipPrecision = lf.lfClipPrecision; this.lfQuality = lf.lfQuality; this.lfPitchAndFamily = lf.lfPitchAndFamily; this.lfFaceName = lf.lfFaceName; }
public DRAWTEXTPARAMS(IntNativeMethods.DRAWTEXTPARAMS original) { this.cbSize = Marshal.SizeOf(typeof(IntNativeMethods.DRAWTEXTPARAMS)); this.iLeftMargin = original.iLeftMargin; this.iRightMargin = original.iRightMargin; this.iTabLength = original.iTabLength; }
private static extern IntPtr IntExtCreatePen(int fnStyle, int dwWidth, IntNativeMethods.LOGBRUSH lplb, int dwStyleCount, [MarshalAs(UnmanagedType.LPArray)] int[] lpStyle);
public static IntPtr ExtCreatePen(int fnStyle, int dwWidth, IntNativeMethods.LOGBRUSH lplb, int dwStyleCount, int[] lpStyle) { return System.Internal.HandleCollector.Add(IntExtCreatePen(fnStyle, dwWidth, lplb, dwStyleCount, lpStyle), CommonHandles.GDI); }
public static extern int DrawTextA(HandleRef hDC, byte[] lpszString, int byteCount, ref IntNativeMethods.RECT lpRect, int nFormat);
public static bool MoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt) { return IntMoveToEx(hdc, x, y, pt); }
public static int GetTextMetrics(HandleRef hDC, ref IntNativeMethods.TEXTMETRIC lptm) { if (Marshal.SystemDefaultCharSize == 1) { IntNativeMethods.TEXTMETRICA textmetrica = new IntNativeMethods.TEXTMETRICA(); int textMetricsA = GetTextMetricsA(hDC, ref textmetrica); lptm.tmHeight = textmetrica.tmHeight; lptm.tmAscent = textmetrica.tmAscent; lptm.tmDescent = textmetrica.tmDescent; lptm.tmInternalLeading = textmetrica.tmInternalLeading; lptm.tmExternalLeading = textmetrica.tmExternalLeading; lptm.tmAveCharWidth = textmetrica.tmAveCharWidth; lptm.tmMaxCharWidth = textmetrica.tmMaxCharWidth; lptm.tmWeight = textmetrica.tmWeight; lptm.tmOverhang = textmetrica.tmOverhang; lptm.tmDigitizedAspectX = textmetrica.tmDigitizedAspectX; lptm.tmDigitizedAspectY = textmetrica.tmDigitizedAspectY; lptm.tmFirstChar = (char) textmetrica.tmFirstChar; lptm.tmLastChar = (char) textmetrica.tmLastChar; lptm.tmDefaultChar = (char) textmetrica.tmDefaultChar; lptm.tmBreakChar = (char) textmetrica.tmBreakChar; lptm.tmItalic = textmetrica.tmItalic; lptm.tmUnderlined = textmetrica.tmUnderlined; lptm.tmStruckOut = textmetrica.tmStruckOut; lptm.tmPitchAndFamily = textmetrica.tmPitchAndFamily; lptm.tmCharSet = textmetrica.tmCharSet; return textMetricsA; } return GetTextMetricsW(hDC, ref lptm); }
public static extern bool IntMoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt);
public static int GetObject(HandleRef hFont, IntNativeMethods.LOGFONT lp) { return IntGetObject(hFont, Marshal.SizeOf(typeof(IntNativeMethods.LOGFONT)), lp); }
public static int GetObject(HandleRef hBrush, IntNativeMethods.LOGBRUSH lb) { return IntGetObject(hBrush, Marshal.SizeOf(typeof(IntNativeMethods.LOGBRUSH)), lb); }
internal static extern bool ExtTextOut(HandleRef hdc, int x, int y, int options, ref IntNativeMethods.RECT rect, string str, int length, int[] spacing);
public static extern int DrawTextW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat);
public static extern int DrawTextExW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams);