[Mono-winforms-list] Odd StatusStrip.PreferredSize behavior

Mike Fried michaelbfried at gmail.com
Mon May 17 17:20:05 EDT 2010


I'm writing a program under Windows in Visual Studio (2008, switching to
2010 soon) that will target Linux using Windows Forms and .NET Framework/CLR
2, but I started testing under Mono and making changes to work around issues
in Mono and in Mono under Linux only recently (using Ubuntu 10.4 and SUSE).

I discovered a bunch of bugs that don't reproduce on Windows, many of which
I could simply work around by switching off the System.Environment variable
or working around in trivial ways, but I'm looking for a better solution in
particular for one bug. The current bug that's biting me is that in a custom
editor that I have written, I perform manual layout of the scrollbars and
status bar, but when I go to get the PreferredSize from the StatusStrip in
Mono (Windows and Linux), it returns (22, Height) and in .NET it returns
(Width, 22).

I took a peek at the source code to the Mono 2.6.4 branch of
StatusStrip<http://anonsvn.mono-project.com/viewvc/branches/mono-2-6-4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs?revision=155916&sortby=file>and
ToolStrip<http://anonsvn.mono-project.com/viewvc/branches/mono-2-6-4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs?revision=155916&sortby=file>
to
try and understand what's going on, and I tried a number of things without
making some kind of test against the width or height to work around the
preferred size being "wrong", but I couldn't get the desired behavior. I've
searched the web without finding anything else about this.

Is this a known issue? Does anyone have any alternative APIs that they
suggest I use instead? I'd like to fix this code and move on so that
regardless of what kind of Fix mono takes later, it won't break my code in
the future.

Thanks,
Mike Fried
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20100517/47b71ea6/attachment.html 


More information about the Mono-winforms-list mailing list