3.4. Drawing a Pie Chart

Let’s look at one more real-world application. In this example we will develop an application that draws pie charts based on a data feed. Pie charts are useful when you need to represent statistical data in a graphical way—for example, the percentage of users visiting a Web site from different countries, or the percentage grades in different subjects. In our example we will use the DrawPie and FillPie methods.

First we create a Windows application and add four buttons, a text box, and a list box control. We change the text and names of the text box, and our final form looks like Figure 3.43. In the Enter Share text box we will enter a number to represent the share of total items. For example, add five values in the share ...

Get Graphics Programming with GDI+ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.