[Gtk-sharp-list] System.Drawing Gdk binding

Miguel de Icaza miguel@ximian.com
Wed, 07 Apr 2004 00:53:11 -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 :)

One trick that you can use is to use reflection to find the "hidden"
method and call it:

Type graphics_type = typeof (Graphics);
Type [] arg_types = new Type {typeof (arg1), typeof (arg2) }
ConstructorInfo ci = graphics_type.FindMembers(..., ".ctor", arg_types);
ci.Invoke (...);

The reason is that we should not expose in our APIs things that are not
part of the Microsoft APIs, or we would break compatibility.

That is why we have to resort to tricks like that.

Miguel.