[MonoDevelop] S.W.F -> Gtk# Mappings
John Luke
jluke@users.sourceforge.net
Thu, 22 Jan 2004 16:04:19 -0500
--=-1pldzIogmAFH4aJ8mc+u
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2004-01-15 at 10:26 +0000, Jonathan Darrer wrote:
> I've put together a simple Form. If someone would like to port it to Gtk# to
> demonstrate the process.
Here is roughly the same thing in Gtk#, but I didn't port the original
code, I just wrote it from the screenshot. Keep in mind it would be
slightly different using Glade and/or Gnome in addition to Gtk. Also, I
could have done a better job with the spacing.
mcs WinForm.cs -r gtk-sharp
--=-1pldzIogmAFH4aJ8mc+u
Content-Disposition: attachment; filename=WinForm.cs
Content-Type: application/octet-stream; name=WinForm.cs
Content-Transfer-Encoding: 7bit
using System;
using Gtk;
using GtkSharp;
class WinForm
{
Entry entry;
Label bigLabel;
static void Main (string[] args)
{
new WinForm ();
}
WinForm ()
{
Application.Init ();
Window win = new Window ("Sample Winform");
win.SetDefaultSize (400, 300);
win.DeleteEvent += new DeleteEventHandler (OnWindowDelete);
win.BorderWidth = 12;
VBox vbox = new VBox (false, 0);
Frame frame = new Frame ();
vbox.PackStart (frame);
VBox inner = new VBox (false, 6);
inner.PackStart (new Label ("Type into the textbox and press the button."), false, true, 0);
HBox hbox = new HBox (false, 0);
entry = new Entry ();
Button pressme = new Button ("Press Me!");
pressme.Clicked += new EventHandler (OnClicked);
hbox.PackStart (entry, false, true, 0);
hbox.PackStart (pressme, false, false, 0);
inner.PackStart (hbox, false, true, 0);
bigLabel = new Label ();
inner.PackStart (bigLabel, true, true, 0);
frame.Add (inner);
win.Add (vbox);
win.ShowAll();
Application.Run ();
}
void OnClicked (object o, EventArgs args)
{
bigLabel.Markup = "<span font_desc=\"Monospace 24\" color=\"blue\">" + entry.Text + "</span>";
}
void OnWindowDelete (object obj, DeleteEventArgs args)
{
Application.Quit();
}
}
--=-1pldzIogmAFH4aJ8mc+u--