[Mono-list] Question on System.Windows.Forms

Rolf Bjarne Kvinge rolflists at ya.com
Thu Feb 22 10:59:02 EST 2007


>
>From: Huub van Niekerk [mailto:huubvanniekerk at gmail.com] 
>Sent: jueves, 22 de febrero de 2007 16:40
>To: Rolf Bjarne Kvinge
>Subject: Re: [Mono-list] Question on System.Windows.Forms
>
>>On 2/22/07, Rolf Bjarne Kvinge <rolflists at ya.com> wrote:
>>
>>
>>
>>If you show us the code and the command line you're trying to compile with
>>it would be easier to find the problem :)
>>
>>Rolf
>
>Hi Rolf,
>
>Since it took 3 days till my message showed up in the list, I hope you
don't mind I answer you directly. 
>
>The gmcs command: gmcs -pkg:gtk-sharp /r:System.Windows.Forms.dll
/r:System.Drawing /r:System.dll Main.cs MainWindow.cs AssemblyInfo.cs
gtk-gui/generated.cs
>
>The code (MainWindow.cs):
>
>using System;
>using System.Windows.Forms;
>using Gtk;
>
>public class MainWindow: Gtk.Window
>{    
>    public MainWindow (): base ("")
>    {
>        Stetic.Gui.Build (this, typeof(MainWindow));
>    }
>    
>    protected void OnDeleteEvent (object sender, DeleteEventArgs a)
>    {
>        Application.Quit ();
>        a.RetVal = true;
>    }
>
>    protected virtual void OnButton1Clicked(object sender, System.EventArgs
e)
>    {
>        MessageBox.Show("Welkom bij het\nwindows programmeren");
>    }
>}

You're mixing WinForms and Gtk#, they are two different toolkits for GUI
applications (see http://www.mono-project.com/Gui_Toolkits).
You should only be using one at a time.

Rolf

>Errors from within MonoDevelop (these errors appear twice each):
>
>The type or namespace name `Windows.Forms' could not be found. Are you
missing a using directive or an assembly reference?(CS0246) 
>[The type or namespace name `Windows' does not exist in the namespace
`System'. Are you missing an assembly reference?(CS0234)
>
>Same happens if I use System.Drawing or System.Drawings instead of
System.Windows.Forms , be it with the respective errors.
>
>BTW: I solved the crashing of f-spot on Fedora Core 6. Cause was that I had
installed mono from the mono-project repository, instead of the Fedora
repository. Unfortunately, it didn't solve the compile problems. 
>
>Thanks for helping out.



More information about the Mono-list mailing list