19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

272 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

Private Sub ShowLegend()<br />

‘Show legend<br />

picEnroll.DrawStyle = 2<br />

picEnroll.Line (.1, 1.05 * maxEnroll)-(.9, 1.05 * maxEnroll)<br />

Call Locate(1, 1.1 * maxEnroll)<br />

picEnroll.Print “Male”<br />

picEnroll.DrawStyle = 1<br />

picEnroll.Line (.1, .95 * maxEnroll)-(.9, .95 * maxEnroll)<br />

Call Locate(1, maxEnroll)<br />

picEnroll.Print “Female”<br />

picEnroll.DrawStyle = 0<br />

picEnroll.Line (.1, .85 * maxEnroll)-(.9, .85 * maxEnroll)<br />

Call Locate(1, .9 * maxEnroll)<br />

picEnroll.Print “Total”<br />

End Sub<br />

Private Sub ShowTitle()<br />

‘Display source <strong>and</strong> title<br />

Call Locate(-.5, -.1 * maxEnroll)<br />

picEnroll.Print “Source: Statistical Abstract of the United States”<br />

Call Locate(.5, 1.2 * maxEnroll)<br />

picEnroll.Print “Two-Year College Enrollments (in thous<strong>and</strong>s)”<br />

End Sub<br />

FIGURE 9-11 Chart for Example 2<br />

COMMENT<br />

1. The line charts drawn in Examples 1 <strong>and</strong> 2 can be printed on the printer instead<br />

of displayed in a picture box. Just replace each occurrence of picOutput with<br />

Printer, <strong>and</strong> add<br />

Printer.EndDoc<br />

as the last statement of the cmdDraw_Click event procedure. Also, the charts<br />

will look best in l<strong>and</strong>scape orientation which is invoked with the statement<br />

Printer.Orientation = 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!