882425cc53
* sample/rsvg : Created place to put sample program that uses Rsvg#. * sample/Makefile.in : Edited it to make it "make" the stuff in "sample/rsvg". * sample/rsvg/Makefile.in : Added it to "make" the Rsvg# sample program. * sample/rsvg/svghelloworld.cs : Added it. It's the sample Rsvg# program. * sample/rsvg/sample.svg : Added it. It's a sample SVG file that the program displays. * configure.in : Modified it so it will create sample/rsvg/Makefile from sample/rsvg/Makefile.in. svn path=/trunk/gtk-sharp/; revision=12504
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
//
|
|
// samples/rsvg/svghelloworkd.cs
|
|
//
|
|
// Author: Charles Iliya Krempeaux
|
|
//
|
|
|
|
class SvgHelloWorld
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Gnome.Program program =
|
|
new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args);
|
|
|
|
MyMainWindow app = new MyMainWindow(program);
|
|
app.Show();
|
|
|
|
program.Run();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class MyMainWindow
|
|
: Gnome.App
|
|
{
|
|
Gnome.Program program;
|
|
|
|
public MyMainWindow(Gnome.Program gnome_program)
|
|
: base("SVG Hello World", "SVG Hello World")
|
|
{
|
|
this.program = gnome_program;
|
|
|
|
this.DeleteEvent += new GtkSharp.DeleteEventHandler(delete_event);
|
|
|
|
|
|
string svg_file_name = "sample.svg";
|
|
Gdk.Pixbuf pixbuf = Rsvg.Tool.PixbufFromFile(svg_file_name);
|
|
|
|
Gtk.Image image = new Gtk.Image();
|
|
image.Pixbuf = pixbuf;
|
|
|
|
this.Contents = image;
|
|
}
|
|
|
|
private void delete_event(object obj, GtkSharp.DeleteEventArgs args)
|
|
{
|
|
this.program.Quit();
|
|
}
|
|
}
|
|
|
|
|