Ahoj,
Mam kod, ktery jsem nekde nasel:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Test
{
public class Prvni
{
public static void Main()
{
Application.Run(new Form1());
return;
}
}
public class Form1: Form
{
Label label1 = new Label();
TextBox textBox1 = new TextBox();
Button button1 = new Button();
Label label2 = new Label();
public Form1()
{
label1.Location = new Point(56, 48);
label1.Name = "label1";
label1.TabIndex = 0;
label1.Text = "Enter Ur Name : ";
textBox1.Location = new Point(176, 48);
textBox1.Name = "textBox1";
textBox1.Text = "";
button1.Location = new Point(128, 104);
button1.Name = "button1";
button1.Text = "Click Me";
label2.Location = new Point(88, 192);
label2.Name = "label2";
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(button1);
Controls.Add(textBox1);
}
}
}
Kdyz to pustim ve windows, tak to v pohode projde, ale na SuSe 9.3 to nejde. Nekde jsem nasel, ze mam nainstalovat xorg-x11-devel, takze ten mam nainstalovan.
kompilovano to mam prikazem
mcs -r:System.Drawing -r:System.Windows.Forms Prvni.cs
Hlasi me to:
Mono System.Windows.Forms Assembly [Revision: 41731; built: 2005/2/15 5:56:12]
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.DllNotFoundException: libX11
in (wrapper managed-to-native) System.Windows.Forms.XplatUIX11:XInitThreads ()
in <0x0006f> System.Windows.Forms.XplatUIX11:.ctor ()
in <0x0003f> System.Windows.Forms.XplatUIX11:GetInstance ()
in <0x00059> System.Windows.Forms.XplatUI:.cctor ()--- End of inner exception stack trace ---
in <0x00000>
in <0x000c0> System.Windows.Forms.Control:get_CreateParams ()
in <0x0000a> System.Windows.Forms.Label:get_CreateParams ()
in <0x00211> System.Windows.Forms.Control:.ctor ()
in <0x0001b> System.Windows.Forms.Label:.ctor ()
in (wrapper remoting-invoke-with-check) System.Windows.Forms.Label:.ctor ()
in <0x0002c> Test.Form1:.ctor ()
in (wrapper remoting-invoke-with-check) Test.Form1:.ctor ()
in <0x0001a> Test.Prvni:Main ()
Jeste dodam, ze bootuji do KDE.