[Mono-list] Re: [Gtk-sharp-list] System.Drawing Gdk binding

Miguel de Icaza miguel@ximian.com
Thu, 15 Apr 2004 01:12:33 -0400


Hello!

> Hi! Why, of course I'll be working on it, because I need the
> functionality :)
> There're several issues however:
> At first, I tried to put together an independent assembly, but it's a
> real pain because everything useful in System.Drawing is internal and
> private :)
> e.g. to create a Graphics you need to make a static method inside
> Graphics, because all the constructors are private. I didn't find any
> other way at this point. The c binding can however be split from
> libgdiplus.

We can cheat in the Mono world, basically, you can do things like:

ConstructorInfo mi = typeof (Graphics).GetMethod (".ctor", argTypes);

And then you can activate it:

	Activator.CreateInstance (typeof (Graphics), mi, args)

But if you can tell me more about what you need, I can go into more
detail on how to do it.

> On the second hand, Graphics has FromHwnd (which I beleive is wins
> only), so why not have FromGdk? Is it the specification which is so
> pro-windows :)

It would add a depedency on Gtk# to be installed.  But tell me what you
need, and I can get the changes in place, and then we use the workaround
above to call it.

Miguel