Why does Winforms in Mono not open any window?

I am trying to use Winforms for a simple application on my Mac in Mono C #, so far I have 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 the window doesn't open when I check it, any help? I think my question is specific to Mono.

+6
source share
1 answer

I have the same problem by running os x mavericks + mono 3.2.3.

I created a demo: http://mono-project.com/Mono_Basics , the first two are processed (console + gtk), but the third (dotnet) does not do anything when I run it from the terminal, it does not throw any errors, I just do the processor load but the window does not appear ...

in the end, I found a solution the first time dotnet was launched, it took about 1 minute until the window showed, the next time it was launched immediately. when I tested, I killed the process in 5-10 seconds, so why didn’t I work on my first try ...

+5
source

Source: https://habr.com/ru/post/951947/


All Articles