C#의 콘솔 응용 프로그램에서 작업 중이므로 콘솔을 최대화해야합니다. 콘솔 창에서 최대화 버튼을 누르기 만하면 높이가 아니라 폭이 최대화됩니다. 내 컴퓨터에서 원하는 거의 작동하지만 다른 컴퓨터에 오류가 있습니다콘솔 윈도우 최대화 - C#
Console.WindowWidth = 150;
Console.WindowHeight = 61;
: 나는 다음과 같은 코드를 사용하려고 노력했다. 콘솔을 최대화하려면 어떻게해야합니까?
C#의 콘솔 응용 프로그램에서 작업 중이므로 콘솔을 최대화해야합니다. 콘솔 창에서 최대화 버튼을 누르기 만하면 높이가 아니라 폭이 최대화됩니다. 내 컴퓨터에서 원하는 거의 작동하지만 다른 컴퓨터에 오류가 있습니다콘솔 윈도우 최대화 - C#
Console.WindowWidth = 150;
Console.WindowHeight = 61;
: 나는 다음과 같은 코드를 사용하려고 노력했다. 콘솔을 최대화하려면 어떻게해야합니까?
CLR을 사용할 수 없습니다. Win32 API 호출을 가져와 컨테이너 창을 찔러야합니다. 다음은 도움이 될 수 있습니다.
using System.Diagnostics;
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern bool ShowWindow(System.IntPtr hWnd, int cmdShow);
private static void Maximize()
{
Process p = Process.GetCurrentProcess();
ShowWindow(p.MainWindowHandle, 3); //SW_MAXIMIZE = 3
}
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int HIDE = 0;
private const int MAXIMIZE = 3;
private const int MINIMIZE = 6;
private const int RESTORE = 9;
static void Main(string[] args)
{
ShowWindow(ThisConsole, MINIMIZE);
}
_What 오류는 get_합니까? 읽어 봤니? – SLaks
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193(v=vs.85).aspx – SLaks
이것을 읽고 SLaks 주석을보십시오 : http://stackoverflow.com/questions/ 7670633/C-sharp-for-a-console-in-c-sharp –