I just installed the new MonoDevelop Windows beta, but when trying to create a C# windows application the only option was GTK#. Since Mono supports WinForms, why is this not an option in MonoDevelop. I would like to not have the GTK# dependency in my applications.
-
3Yeah, but that's not the point, I just want to use MonoDevelop...for a whole bunch of reasons. – Adam Haile Sep 09 '09 at 21:46
3 Answers
Althought Winforms is supported in mono since version 2.0, the WinForms designer is not usable yet in MonoDevelop, which could be the reason for the lack of a WinForms project in MonoDevelop
http://www.mono-project.com/WinForms_Designer
AFAIK, you should think of mono's support for winforms as a way to port existing winforms aplication to linux. If you want to make a cross-platform app from the ground up, you should use GTK#

- 4,597
- 1
- 31
- 45
Although there is no WinForms project template, you can write WinForms apps in MD on any of the platforms MD runs on.
Just create a new empty C# project and add a reference to System.Windows.Forms, then write your code, and build & run. Although there's no Winforms designer in MD, you'll have code completion for the Winforms types.

- 16,113
- 2
- 44
- 50
-
1We are using the System.Windows.Forms namespace as we already have our UIs built. For additional work in the UI we are using SharpDevelop, and then coding in MD. – IAbstract Feb 22 '10 at 03:38
Sorry for raising the dead, but I tried to do this recently. While MonoDevelop doesn't provide the GUI designer, you can indeed write Winforms by hand, as mhutch pointed out. It goes like this:
- Create a new, empty C# project.
- Add a reference to System.Windows.Forms
- Create a new, empty C# file:
The contents of the file:
using System;
using System.Windows.Forms;
namespace HelloForms
{
public class MainForm: Form
{
Label label1 = new Label();
public MainForm ()
{
this.SuspendLayout();
// Initialize your components here
this.label1.Text = "Hello, World!";
this.Controls.Add(label1);
this.ResumeLayout();
this.Name = "MainForm Name.";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm Title!";
}
}
public class Program
{
public static void Main(string[] args) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm ());
}
}
}
Expand your Form by adding components to MainForm's constructor.

- 532
- 6
- 15