문제

I'm having the weirdest problem here with a Windows App written in c#.

Although there is absolutely nothing special about it, the main window works perfectly well on the Primary monitor and on any Secondary monitor when the latter is configured to stand on the right of the Primary monitor. However, when I reconfigure the secondary screen to be placed on the left side of my Primary monitor, I (and others) no longer can change the size of the form. The mouse-pointer does NOT change into the 'NW-SE-arrows', nor does clicking & dragging the edge react in any change towards the size of the window.

Doing some extra experimenting this seems to surface only when I have the AutoSizeMode of the form set to GrowAndShrink !?

Is this some kind of bug or am I misinterpreting the property ?

To reproduce this problem you should

  • start a new WinForms project
  • Add a StatusStrip to the bottom of the form
  • Run the project (Debug/Any CPU in my case)
  • Drag the form to the secondary monitor that stands LEFT of your primary monitor

PS: it seems that when I remove the StatusStrip, I can't resize the form at all, so I'm guessing this is some side-effect/bug in the StatusStrip object...

Adding a checkbox with the following code behind makes it pretty clear that the issue revolves around the AutoSizeMode property

private void chkAutoGrowAndShrink_CheckedChanged(object sender, EventArgs e) 
{ 
     this.AutoSizeMode = chkAutoGrowAndShrink.Checked ? 
             AutoSizeMode.GrowAndShrink : 
             System.Windows.Forms.AutoSizeMode.GrowOnly; 
}

UPDATE:

As I've recently switched machines I've now redone the test on this new laptop using VS2010 and hold & behold, the issue is no longer. I'm still not sure where this came from, maybe it got fixed in .NET over time, maybe it was a driver issue... I guess we'll never now but it seems there is little use to keep this question here so I'll just mark it for closing. Thanks to all who put some of their precious time in it though!

도움이 되었습니까?

해결책 2

Seems this issue was hardware/driver/specific version of .NET/??? related. Closing question as such.

다른 팁

If you can't resize with the StatusStrip not on the form, then there is another issue going on here. All forms should be resizable unless you set the FormBorderStyle property to a Fixed style.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top