Hi!

I have begun wrapping DiaCanvas2, partly because I might use it in a
project creating a UML diagramming tool and partly as a learning
exercise. Attached is sample code and a screendump of the code running.
One Cant do much with it yet, only draw lines.

Along the wrapping path, I have been learning a little bit here and
there and decided that a tutorial was in place. A first hit at that can
be found here: http://go-mono.com/tutorial/ in chapter 27.
The chapter is in cvs and it may take some time before the website
reflects it.
I encurage anyone who might have something to contribute to that
tutorial, cause I am not the best man for that job .. at least not yet.

Happy hacking!
-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail  [EMAIL PROTECTED]               Website mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------              

<<attachment: diacanvas-sharp.png>>

using System;
using DiaCanvas;
using Gtk;
using GtkSharp;

public class Sample {

        static void Main()
        {
                Application.Init();

                Canvas canvas = new Canvas();
                View view = new View (canvas, true);
                view.Show();

                Tool tool = new PlacementTool (Line.Type);
                tool.ButtonPress += new ButtonPressHandler (button_press);
                view.Tool = tool;

                Window window = new Window ("DiaCanvas C# sample");
                window.Add (view);
                window.Show();
                window.DeleteEvent += new DeleteEventHandler (Quit);

                Application.Run();
        }

        static void Quit (object sender, DeleteEventArgs args) 
        {
                Application.Quit();
                args.RetVal = true;
        }

        static void button_press (Tool tool, View view, 
                                  Gdk.Event e, IntPtr data)
        {
                Console.WriteLine ("ButtonPress");
                view.Tool = null;
        }
}

Reply via email to