public static bool GetViewportExtEx(HandleRef hdc, [In, Out] IntNativeMethods.SIZE lpSize) { bool retVal = IntGetViewportExtEx(hdc, lpSize); DbgUtil.AssertWin32(retVal, "GetViewportExtEx([hdc=0x{0:X8}], [out size]) failed.", hdc.Handle); return(retVal); }
public static bool SetViewportExtEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.SIZE size) { bool retVal = IntSetViewportExtEx(hDC, x, y, size); DbgUtil.AssertWin32(retVal, "SetViewportExtEx([hdc=0x{0:X8}], x=[{1}], y=[{2}], [out size]) failed.", hDC.Handle, x, y); return(retVal); }
public static int GetTextExtentPoint32(HandleRef hDC, string text, [In, Out] IntNativeMethods.SIZE size) { int byteCount = text.Length; int retVal = GetTextExtentPoint32W(hDC, text, text.Length, size); DbgUtil.AssertWin32(retVal != 0, "GetTextExtentPoint32(hdc=[0x{0:X8}], text=[{1}], size=[{2}] failed.", hDC.Handle, text, size); return(retVal); }
public static int GetTextExtentPoint32(HandleRef hDC, string text, [In, Out] IntNativeMethods.SIZE size) { int length = text.Length; if (Marshal.SystemDefaultCharSize == 1) { byte[] pOutBytes = new byte[WideCharToMultiByte(0, 0, text, text.Length, null, 0, IntPtr.Zero, IntPtr.Zero)]; WideCharToMultiByte(0, 0, text, text.Length, pOutBytes, pOutBytes.Length, IntPtr.Zero, IntPtr.Zero); length = Math.Min(text.Length, 0x2000); return(GetTextExtentPoint32A(hDC, pOutBytes, length, size)); } return(GetTextExtentPoint32W(hDC, text, text.Length, size)); }
public static int GetTextExtentPoint32(HandleRef hDC, string text, [In, Out] IntNativeMethods.SIZE size) { int retVal; int byteCount = text.Length; if (Marshal.SystemDefaultCharSize == 1) { // Convert Unicode string to ANSI. 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(text.Length, IntNativeMethods.MaxTextLengthInWin9x); retVal = GetTextExtentPoint32A(hDC, textBytes, byteCount, size); } else { retVal = GetTextExtentPoint32W(hDC, text, text.Length, size); } DbgUtil.AssertWin32(retVal != 0, "GetTextExtentPoint32(hdc=[0x{0:X8}], text=[{1}], size=[{2}] failed.", hDC.Handle, text, size); return(retVal); }
public static extern bool IntSetViewportExtEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.SIZE size);
public static extern bool IntGetViewportExtEx(HandleRef hdc, [In, Out] IntNativeMethods.SIZE lpSize);
public static extern int GetTextExtentPoint32W(HandleRef hDC, string text, int len, [In, Out] IntNativeMethods.SIZE size);
public static extern int GetTextExtentPoint32A(HandleRef hDC, byte[] lpszString, int byteCount, [In, Out] IntNativeMethods.SIZE size);
public static bool SetViewportExtEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.SIZE size) { return(IntSetViewportExtEx(hDC, x, y, size)); }
public static bool GetViewportExtEx(HandleRef hdc, [In, Out] IntNativeMethods.SIZE lpSize) { return(IntGetViewportExtEx(hdc, lpSize)); }