.NET ez 2012-11-11
可以利用 Win32 API 控制 Console 視窗 最大化 或 最小化。
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetWindowPos(
IntPtr hWnd,
IntPtr hWndInsertAfter,
int x,
int y,
int cx,
int cy,
int uFlags);
private const int HWND_TOPMOST = -1;
private const int SWP_NOMOVE = 0x0002;
private const int SWP_NOSIZE = 0x0001;
要控制視窗時只要呼叫:
ShowWindow(ThisConsole, MAXIMIZE);
標籤: .NET
本文章網址:
https://www.ez2o.com/Blog/Post/csharp-Change-Console-Window-Size
https://www.ez2o.com/Blog/Post/294
https://www.ez2o.com/Blog/Post/csharp-Change-Console-Window-Size
https://www.ez2o.com/Blog/Post/294
