When I try to create an object of Graphics, why doesn't the following work?
System.Drawing.Graphics graphicsObj = new System.Drawing.Graphics();
(I am aware that I could create a private System.Windows.Forms.Panel Obj;
and then do CreateGraphics()
if I wanted it to work)
I tried to find a custom constructor for Graphics, but I couldn't find one. Where did Microsoft define it, or how did it block it?
Default constructors are only created by the C# compiler if there are no other declared constructors. In this case it looks like all constructors are internal or private. Basically you don't construct one yourself - you ask for one from an image, control or whatever, or get given one for paint events etc.