다중 모니터 시스템에 문제가 있고 경계선없는 WPF C # .NET 4.0 창을 최대화하는 데 문제가 있습니다. 하나의 모니터는 1680x1050 (기본)이고 두 번째는 1920x1080 (보조)입니다. 기본 화면에서 내 창을 최대화 할 때-이 두 화면의 순서를 전환해도 문제가 없습니다. 그러나 보조 화면에서 최대화하려고 할 때마다 기본 모니터 크기로 잘립니다. 창 크기가 적절하게 지정되어 있지만 작동하지 않습니다.
모니터 크기 얻기 :
private System.Windows.Forms.Screen GetCurrentScreen()
{
System.Drawing.Point centerPoint = new System.Drawing.Point((int)(Left + Width / 2), (int)(Top + Height / 2));
foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens)
{
if (s.Bounds.Contains(centerPoint))
{
return s;
}
}
return null;
}
최대화 :
private void Maximize
{
if (this.WindowState == WindowState.Normal)
{
var scr = GetCurrentScreen();
//this.MaxHeight = scr.WorkingArea.Height;
//this.MaxWidth = scr.WorkingArea.Width;
if (scr != null)
{
if (scr.Primary)
{
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
this.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
}
else
{
this.MaxHeight = double.PositiveInfinity; //even ridiculous values don't work
this.MaxWidth = double.PositiveInfinity;
this.Height = scr.WorkingArea.Height; // correct values of 2nd screen
this.Width = scr.WorkingArea.Width;
}
}
else
{
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
this.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
}
this.WindowState = WindowState.Maximized;
}
내가 얻는 것은 : http://imgur.com/ZYzVV9Q,yf7lSfY#1
내가 원하는 것 : http://imgur.com/ZYzVV9Q,yf7lSfY#0
감사
두 화면에서 복제 할 수 없기 때문에 코드 중 일부가이 문제를 일으킬 가능성이 있습니다 ... 둘 다 같은 크기이지만 하나에서 해상도를 변경해도 응용 프로그램은 여전히 올바르게 최대화됩니다. 새 WPF 응용 프로그램을 시작하고
WindowState = "Maximized"
Window 선언에 여전히 동일한 문제가 있습니까?
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다