I'm trying to use Winforms for a simple application on my Mac in Mono C#, so far I've tested this code
using System;
using System.Drawing;
using System.Windows.Forms;
public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}
public HelloWorld ()
{
Button b = new Button ();
b.Text = "Click Me!";
b.Click += new EventHandler (Button_Click);
Controls.Add (b);
}
private void Button_Click (object sender, EventArgs e)
{
MessageBox.Show ("Button Clicked!");
}
}
But no window is opening when I test it, any help? I think my question is specific to Mono.
But Microsoft begs to differ. "We continue to support and innovate in Windows Forms runtime," said Microsoft's Igor Velikorossov last month in announcing what's new for WinForms in .
NET Core and language features. Open source improvements to WPF and WinForms for . NET Core.
i have the same issue, running os x mavericks + mono 3.2.3 .
i built the demos from here : http://mono-project.com/Mono_Basics , the first two worked (console+gtk) but the third (dotnet) does nothing when i run it from Terminal, doesn't throw any error, i only makes cpu load, but no window is shown...
in the end , i found the solution, on the first dotnet run, it takes about 1 minute until the window shows, on the next run it's instant. when i was testing, i was killing the process after 5-10 seconds, so that's why i didn't worked for me on first try...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With