Click to See Complete Forum and Search --> : Working with the Graphic class


Brad Jones
October 25th, 2002, 09:14 AM
Does anyone know why the Graphics class in System. Drawing does not use a constructor to create an object?

You would think that....

System.Drawing.Graphic g = new System.Drawing.Graphic();

would be the way to create a Graphic object, but is isn't.

You have to do:

System.Drawing.Graphic g = CreateGraphic();

Does anyone know why the Graphic constructor wasn't simply overloaded with something like CreateGraphic? I've only just now digging into GDI+, so if I'm missing something, any enlightment would be appreciated.

Brad!

IsaacTheIceMan
June 19th, 2003, 01:02 PM
My guess is that the CreateGraphics function doesn't really return a new Graphics Device pointer but a pointer to one that already exists. However, if that was the case then the name of the function should be something like GetGraphics instead.