A Guided Garden Stroll through the .NET Framework Class Library
Namespace: SYSTEM.DRAWING
● I am the Drawing Namespace. If you need Printing capability in your application, or if you need to create graphs and charts on the fly for your web or desktop applications, or need to give your end-users the ability to place text and graphics in a design space by XY coordinates, then I’m the Namespace for you. In addition, I can provide geometric transforms to give you that 3D look in a 2D space such as your users’ video screens and paper prints.
I also provide a set of classes in my System.Drawing.Design Namespace so that you can create components requiring a design surface in Visual Studio, just like the Forms designer that you’ve been using.
I am the absolute coolest of all. I provide a quite easy-to-use object interface to the GDI+ Windows API.
My most famous class is System.Drawing.Graphics which, in conjunction with my System.Drawing.Pen or Brush class, will get you into 2D drawing in no time.
To draw a line on a form, for example, simply use my Graphics object to represent your Windows form as a design surface by passing ActiveForm.Handle to the Graphics.FromHwnd method. Then create a new Pen object, telling it what color to use and how thick the line should be. And finally invoke my Graphics.DrawLine method, giving it the Pen object you created and the starting and ending XY coordinate pairs.
And if you want, I provide patterns and Bevel, Miter and Round joins between lines. I can draw curves, arcs and Bezier Splines and Polygons. I also have a Graphics.DrawPie class that can be used to instantly produce great pie charts.
For advanced typography work you can use my System.Drawing.Text namespace with my Font class. To see what fonts are installed on your users’ computer, you can simply call my System.Drawing.Text.InstalledFontCollection method which you can then iterate through to see what Fonts and Font Families the fonts belong to.
The list of tools that I provide to you is nearly endless. You can open image files of type BMP, GIF, JPEG, EXIF, PNG and TIFF. Then you can manipulate these files by scaling and cropping, flipping, skewing and rotating by simply calling my Graphics.ScaleTransform, RotateTransform, RotateFlip, etc. methods.
What do you think? Am I really cool or what?