зеркало из https://github.com/mono/mail-archives.git
145 строки
5.5 KiB
HTML
145 строки
5.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] re:Code Sample
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:craig%40ip80.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="003433.html">
|
|
<LINK REL="Next" HREF="003435.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] re:Code Sample
|
|
</H1>
|
|
<B>Craig Williams
|
|
</B>
|
|
<A HREF="mailto:craig%40ip80.com"
|
|
TITLE="[Gtk-sharp-list] re:Code Sample">craig@ip80.com
|
|
</A><BR>
|
|
<I>Fri, 20 Feb 2004 07:25:26 -0500</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="003433.html">[Gtk-sharp-list] [Help] Code Sample
|
|
</A></li>
|
|
<LI> Next message: <A HREF="003435.html">[Gtk-sharp-list] Cancelling events
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#3434">[ date ]</a>
|
|
<a href="thread.html#3434">[ thread ]</a>
|
|
<a href="subject.html#3434">[ subject ]</a>
|
|
<a href="author.html#3434">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>I think you need the following lines;
|
|
|
|
Application.Init(); // first line
|
|
|
|
Application.Run(); // last line of Main
|
|
|
|
Application.Quit(); // in your closing event handler
|
|
|
|
Craig
|
|
|
|
|
|
><i> ----- Original Message -----
|
|
</I>><i> From: "Alessandro Lendaro" <<A HREF="mailto:alendaro1@virgilio.it">alendaro1@virgilio.it</A>>
|
|
</I>><i> To: <<A HREF="mailto:gtk-sharp-list@lists.ximian.com">gtk-sharp-list@lists.ximian.com</A>>
|
|
</I>><i> Sent: Friday, February 20, 2004 6:23 AM
|
|
</I>><i> Subject: [Gtk-sharp-list] [Help] Code Sample
|
|
</I>><i>
|
|
</I>><i>
|
|
</I>><i> > Is somebody willing to post a code sample to make a simple "Hello World"
|
|
</I>><i> > program?
|
|
</I>><i> >
|
|
</I>><i> > I tried to, but the window I open doesn't respond and doesn't show
|
|
</I>><i> > anything in,
|
|
</I>><i> > here the code:
|
|
</I>><i> >
|
|
</I>><i> > (I'm using VS.NET 2002 with the FrameWork v1.0.3705 on a W2000 Server
|
|
</I>><i> > machine, GTK# v. 0.16, no Mono)
|
|
</I>><i> >
|
|
</I>><i> > class Class1
|
|
</I>><i> > {
|
|
</I>><i> > /// <summary>
|
|
</I>><i> > /// Il punto di ingresso principale dell'applicazione.
|
|
</I>><i> > /// </summary>
|
|
</I>><i> > [STAThread]
|
|
</I>><i> > static void Main(string[] args)
|
|
</I>><i> > {
|
|
</I>><i> > try
|
|
</I>><i> > {
|
|
</I>><i> >
|
|
</I>><i> > //AppDomain.CurrentDomain.AppendPrivatePath(@"C:\Programmi\Common
|
|
</I>><i> > Files\GTK\GtKSharp\lib");
|
|
</I>><i> > int rc;
|
|
</I>><i> > Gtk.Button but;
|
|
</I>><i> > Gtk.Label lab;
|
|
</I>><i> >
|
|
</I>><i> > Gtk.Init.Check(out rc,"");
|
|
</I>><i> >
|
|
</I>><i> >
|
|
</I>><i> > Window win = new Window(WindowType.Toplevel);
|
|
</I>><i> > win.Title = "HelloWin";
|
|
</I>><i> > win.DefaultHeight = 100;
|
|
</I>><i> > win.DefaultWidth = 100;
|
|
</I>><i> > win.WindowPosition = WindowPosition.Center;
|
|
</I>><i> >
|
|
</I>><i> > win.DeleteEvent += new
|
|
</I>><i> > GtkSharp.DeleteEventHandler(Class1.DeleteEvent);
|
|
</I>><i> > but = new Button();
|
|
</I>><i> >
|
|
</I>><i> > lab = new Label("Hello World!");
|
|
</I>><i> >
|
|
</I>><i> > ((Container)but).Add(lab);
|
|
</I>><i> > ((Container)win).Add(but);
|
|
</I>><i> >
|
|
</I>><i> > //win.Activate();
|
|
</I>><i> > lab.Show();
|
|
</I>><i> > but.Show();
|
|
</I>><i> > win.Show();
|
|
</I>><i> >
|
|
</I>><i> > Console.WriteLine(rc);
|
|
</I>><i> >
|
|
</I>><i> > }
|
|
</I>><i> > catch (Exception exc)
|
|
</I>><i> > {
|
|
</I>><i> > Console.WriteLine(exc.Message);
|
|
</I>><i> > }
|
|
</I>><i> > finally
|
|
</I>><i> > {
|
|
</I>><i> > Console.ReadLine();
|
|
</I>><i> > }
|
|
</I>><i> > }
|
|
</I>><i> >
|
|
</I>><i> > private static void DeleteEvent(object sender,
|
|
</I>><i> > GtkSharp.DeleteEventArgs e)
|
|
</I>><i> > {
|
|
</I>><i> > Gtk.Main.Quit();
|
|
</I>><i> > }
|
|
</I>><i> > }
|
|
</I>><i> > _______________________________________________
|
|
</I>><i> > Gtk-sharp-list maillist - <A HREF="mailto:Gtk-sharp-list@lists.ximian.com">Gtk-sharp-list@lists.ximian.com</A>
|
|
</I>><i> > <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
|
|
</I>><i> >
|
|
</I>
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="003433.html">[Gtk-sharp-list] [Help] Code Sample
|
|
</A></li>
|
|
<LI> Next message: <A HREF="003435.html">[Gtk-sharp-list] Cancelling events
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#3434">[ date ]</a>
|
|
<a href="thread.html#3434">[ thread ]</a>
|
|
<a href="subject.html#3434">[ subject ]</a>
|
|
<a href="author.html#3434">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|