1.5. Using Transformations

All of the discussion and examples so far have been drawn in C#'s native drawing units: pixels. By default, all of the Graphics object's filling and drawing methods work in pixels.

However, pixels may not always be the most convenient unit for you. For example, suppose you want to draw a simple bar chart showing sales figures between $1M and $30M for the years 1990 through 2000. Since you can't use pixel coordinates as large as (1995, 1,000,000), you'll need to perform some mathematical calculations to map these big values into something that will fit on your screen.

While you can perform those calculations yourself if you like, the Graphics object provides transformation methods that can do this for you. The main ...

Get C# Graphics Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.