[Mono-list] Strange behavior with Screen.PrimaryScreen.Bounds.Width

Steve Ricketts velocedge at hotmail.com
Wed May 19 16:00:57 EDT 2010

openSUSE 11.2, MonoDevelop 2.2.2, Mono 2.6.3

I was positioning a form within a .dll and came across a very strange
result.  I needed to get the screen height and width and used
Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height.  The
height worked as expected, giving a value of 1020.  However, the width
produced a value of 7680 when it should have been 1920!

Also, I found that when I resized the form to the screen width and height
(using the right values), I could no longer shrink it back to the original
size.  I'd set this.Width and this.Height to 320 and 240, looking at those
values in the debugger, it showed the proper values, but the form was still
at the max.  I found that if I subtracted 1 from either the max width or
height, it resized properly.  

So, I guess my questions are:

1. What would make the Screen.PrimaryScreen.Bounds.Width return such a large
2. Why can't I resize a form once it's been set to the screen width and


As I was writing this, I realized that I have 4 desktops... 4 x 1920 = 7680! 
So, I assume that Screen.PrimaryScreen.Bounds.Width is the width of all four
desktops.  Is that correct?

View this message in context: http://mono.1490590.n4.nabble.com/Strange-behavior-with-Screen-PrimaryScreen-Bounds-Width-tp2223502p2223502.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list