콘솔 앱에서 화면 해상도를 얻을 수있는 방법은 무엇입니까?콘솔 앱에서 화면 해상도 가져 오기
Forms
에서 내가 사용할 수 있지만 :
int height = Screen.PrimaryScreen.Bounds.Height;
int width = Screen.PrimaryScreen.Bounds.Width;
을하지만 구체적 방법을 콘솔 찾고 있어요.
따라서 내 문제를 해결하는 방법은 Marc-Antoine Jutras입니다. 나는이 같은 갔다 그래서 나는 int
값이 필요합니다
int height = Convert.ToInt32(SystemParameters.PrimaryScreenHeight);
int width = Convert.ToInt32(SystemParameters.PrimaryScreenWidth);
가있다 결국 콘솔은 단지 창일 뿐이므로 콘솔 응용 프로그램에 대해이 작업을 수행 할 구체적인 방법은 없습니다. 'System.Windows.Forms'를 참조하고 이전과 같은 코드를 사용할 수 있습니다. – Clint
@Clint no. 가능합니다 –
[GDI] (https://stackoverflow.com/a/43656496/6583956)를 사용할 수 있습니다. 그냥 체크 - 매력처럼 작동합니다. 응답에서 스 니펫을 사용하려면'include System.Drawing; using System.Runtime.InteropServices; ' –