[Mono-winforms-list] GDI+ status: InvalidParameter from LinearGradientBrush

Stifu stifu at free.fr
Thu Mar 15 19:11:26 UTC 2012


Sadly, GDI+ and WinForms are simply buggy, especially on Mac.
If you've got an X11 server installed, you could try running your
application this way:

MONO_MWF_MAC_FORCE_X11=1 mono yourapp.exe

This will give better results.


KeithBoynton wrote
> 
> I'm receiving this error when trying to run an application on OS-X under
> Mono which is being ported from Windows.
> 
> Obviously the application runs fine in Windows. I've pulled across the
> .sln and all class files etc. from the Visual Studio 2010 project into my
> MonoDevelop environment in OS-X Lion.
> 
> The solution compiles fine with no errors. However when I try to run it I
> get this error.
> 
> A null reference or invalid value was found [GDI+ status:
> InvalidParameter]
> at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0009d] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:220 
>   at System.Drawing.Drawing2D.LinearGradientBrush..ctor (Rectangle rect,
> Color color1, Color color2, LinearGradientMode linearGradientMode)
> [0x00025] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs:66 
>   at (wrapper remoting-invoke-with-check)
> System.Drawing.Drawing2D.LinearGradientBrush:.ctor
> (System.Drawing.Rectangle,System.Drawing.Color,System.Drawing.Color,System.Drawing.Drawing2D.LinearGradientMode)
>   at
> System.Windows.Forms.ToolStripProfessionalRenderer.OnRenderToolStripPanelBackground
> (System.Windows.Forms.ToolStripPanelRenderEventArgs e) [0x00000] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs:425 
>   at System.Windows.Forms.ToolStripRenderer.DrawToolStripPanelBackground
> (System.Windows.Forms.ToolStripPanelRenderEventArgs e) [0x00000] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripRenderer.cs:124 
>   at System.Windows.Forms.ToolStripPanel.OnPaintBackground
> (System.Windows.Forms.PaintEventArgs e) [0x00007] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripPanel.cs:371 
>   at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message&
> m) [0x0006a] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5236 
>   at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&
> m) [0x0016b] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5006 
>   at System.Windows.Forms.ScrollableControl.WndProc
> (System.Windows.Forms.Message& m) [0x00000] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs:813 
>   at System.Windows.Forms.ContainerControl.WndProc
> (System.Windows.Forms.Message& m) [0x0003c] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs:689 
>   at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
> (System.Windows.Forms.Message& m) [0x00000] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:228 
>   at System.Windows.Forms.Control+ControlNativeWindow.WndProc
> (System.Windows.Forms.Message& m) [0x00000] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:209 
>   at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg,
> IntPtr wParam, IntPtr lParam) [0x0008e] in
> /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:242
> 
> I didn't think I was doing anything particuarly complex, it's a windows
> form with (what I thought) to be standard controls on it.
> 
> Any help/pointers would be greatly appreciated
> 

--
View this message in context: http://mono.1490590.n4.nabble.com/GDI-status-InvalidParameter-from-LinearGradientBrush-tp4475791p4476063.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list