public static int DrawTextEx(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams) { int retVal = DrawTextExW(hDC, text, text.Length, ref lpRect, nFormat, lpDTParams); DbgUtil.AssertWin32(retVal != 0, "DrawTextEx(hdc=[0x{0:X8}], text=[{1}], rect=[{2}], flags=[{3}] failed.", hDC.Handle, text, lpRect, nFormat); return(retVal); }
public static bool FillRect(HandleRef hDC, [In] ref IntNativeMethods.RECT rect, HandleRef hbrush) { bool retVal = IntFillRect(hDC, ref rect, hbrush); DbgUtil.AssertWin32(retVal, "FillRect(hdc=[0x{0:X8}], rect=[{1}], hbrush=[{2}]", hDC.Handle, rect, hbrush.Handle); return(retVal); }
public static int DrawTextEx(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams) { int retVal; if (Marshal.SystemDefaultCharSize == 1) { // CapRectangleForWin9x(ref lpRect); // we have to do this because if we pass too big of a value (<= 2^31) to win9x // it fails and returns negative values as the rect in which it painted the text lpRect.top = Math.Min(Int16.MaxValue, lpRect.top); lpRect.left = Math.Min(Int16.MaxValue, lpRect.left); lpRect.right = Math.Min(Int16.MaxValue, lpRect.right); lpRect.bottom = Math.Min(Int16.MaxValue, lpRect.bottom); // Convert Unicode string to ANSI. int byteCount = IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero); byte[] textBytes = new byte[byteCount]; IntUnsafeNativeMethods.WideCharToMultiByte(IntNativeMethods.CP_ACP, 0, text, text.Length, textBytes, textBytes.Length, IntPtr.Zero, IntPtr.Zero); // Security: Windows 95/98/Me: This value may not exceed 8192. byteCount = Math.Min(byteCount, IntNativeMethods.MaxTextLengthInWin9x); retVal = DrawTextExA(hDC, textBytes, byteCount, ref lpRect, nFormat, lpDTParams); } else { retVal = DrawTextExW(hDC, text, text.Length, ref lpRect, nFormat, lpDTParams); } DbgUtil.AssertWin32(retVal != 0, "DrawTextEx(hdc=[0x{0:X8}], text=[{1}], rect=[{2}], flags=[{3}] failed.", hDC.Handle, text, lpRect, nFormat); return(retVal); }
public Rectangle ToRectangle() { if (this.IsInfinite) { return(new Rectangle(-2147483647, -2147483647, 0x7fffffff, 0x7fffffff)); } IntNativeMethods.RECT clipRect = new IntNativeMethods.RECT(); IntUnsafeNativeMethods.GetRgnBox(new HandleRef(this, this.nativeHandle), ref clipRect); return(new Rectangle(new Point(clipRect.left, clipRect.top), clipRect.Size)); }
/// <devdoc> /// A rectangle representing the window region set with the SetWindowRgn function. /// </devdoc> public Rectangle ToRectangle() { if (IsInfinite) { return(new Rectangle(-Int32.MaxValue, -Int32.MaxValue, Int32.MaxValue, Int32.MaxValue)); } IntNativeMethods.RECT rect = new IntNativeMethods.RECT(); IntUnsafeNativeMethods.GetRgnBox(new HandleRef(this, _nativeHandle), ref rect); return(new Rectangle(new Point(rect.left, rect.top), rect.Size)); }
public static int DrawTextEx(HandleRef hDC, string text, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams) { 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(DrawTextExA(hDC, pOutBytes, num2, ref lpRect, nFormat, lpDTParams)); } return(DrawTextExW(hDC, text, text.Length, ref lpRect, nFormat, lpDTParams)); }
public static extern bool IntFillRect(HandleRef hdc, [In] ref IntNativeMethods.RECT rect, HandleRef hbrush);
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 DrawTextExW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat, [In, Out] IntNativeMethods.DRAWTEXTPARAMS lpDTParams);
public static extern int DrawTextW(HandleRef hDC, string lpszString, int nCount, ref IntNativeMethods.RECT lpRect, int nFormat);
public static IntNativeMethods.RegionFlags GetRgnBox(HandleRef hRgn, [In, Out] ref IntNativeMethods.RECT clipRect) { IntNativeMethods.RegionFlags result = IntGetRgnBox(hRgn, ref clipRect); DbgUtil.AssertWin32(result != IntNativeMethods.RegionFlags.ERROR, "GetRgnBox([hRegion=0x{0:X8}], [out rect]) failed.", hRgn.Handle); return(result); }
public static extern IntNativeMethods.RegionFlags IntGetRgnBox(HandleRef hRgn, [In, Out] ref IntNativeMethods.RECT clipRect);
public static extern int DrawTextA(HandleRef hDC, byte[] lpszString, int byteCount, ref IntNativeMethods.RECT lpRect, int nFormat);
public static IntNativeMethods.RegionFlags GetRgnBox(HandleRef hRgn, [In, Out] ref IntNativeMethods.RECT clipRect) { return(IntGetRgnBox(hRgn, ref clipRect)); }
public static bool FillRect(HandleRef hDC, [In] ref IntNativeMethods.RECT rect, HandleRef hbrush) { return(IntFillRect(hDC, ref rect, hbrush)); }