Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SetWindowPosition()

static unsafe void System.ConsolePal.SetWindowPosition ( int left,
int top )
inlinestatic

Definition at line 869 of file ConsolePal.cs.

870 {
871 global::Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO bufferInfo = GetBufferInfo();
872 global::Interop.Kernel32.SMALL_RECT srWindow = bufferInfo.srWindow;
873 int num = left + srWindow.Right - srWindow.Left;
874 if (left < 0 || num > bufferInfo.dwSize.X - 1 || num < left)
875 {
876 throw new ArgumentOutOfRangeException("left", left, System.SR.ArgumentOutOfRange_ConsoleWindowPos);
877 }
878 int num2 = top + srWindow.Bottom - srWindow.Top;
879 if (top < 0 || num2 > bufferInfo.dwSize.Y - 1 || num2 < top)
880 {
881 throw new ArgumentOutOfRangeException("top", top, System.SR.ArgumentOutOfRange_ConsoleWindowPos);
882 }
883 srWindow.Bottom = (short)num2;
884 srWindow.Right = (short)num;
885 srWindow.Left = (short)left;
886 srWindow.Top = (short)top;
887 if (!global::Interop.Kernel32.SetConsoleWindowInfo(OutputHandle, absolute: true, &srWindow))
888 {
890 }
891 }
static IntPtr OutputHandle
static global::Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO GetBufferInfo()
static Exception GetExceptionForWin32Error(int errorCode, string path="")
static string ArgumentOutOfRange_ConsoleWindowPos
Definition SR.cs:66
Definition SR.cs:7

References System.SR.ArgumentOutOfRange_ConsoleWindowPos, System.ConsolePal.GetBufferInfo(), System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), and System.ConsolePal.OutputHandle.

Referenced by System.Console.SetWindowPosition().