1 / 19

Graphics and Procedures

5. Graphics and Procedures. Programming Right from the Start with Visual Basic .NET 1/e. Objectives. Learn the Visual Logic graphics commands and how they work Appreciate the concept of structured design Know the process for creating procedures. Objectives (cont.).

glora
Télécharger la présentation

Graphics and Procedures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 5 Graphics andProcedures Programming Right from the Start with Visual Basic .NET 1/e

  2. Objectives • Learn the Visual Logic graphics commands and how they work • Appreciate the concept of structured design • Know the process for creating procedures

  3. Objectives (cont.) • Understand the role of procedure arguments • Realize the difference between formal arguments and actual arguments • Develop and evaluate solutions that utilize graphics and procedures

  4. Visual Logic graphics are a variation on Logo Programming Language, which has been used in educational settings for over three decades. 5-1 Graphics

  5. Forward and Turn Right • The Forward command moves the pen a specified number of units. • The Turn Right command rotates the drawing direction a specified number of degrees.

  6. Using Loops • Two Patterns Emerge… • Repetition of the commands Forward and Turn Right • The degrees the drawing direction must turn right are different for each shape and are based on the number of sides in the shape

  7. 5-2 Working with Color • The pen draws with black ink and is 1 unit in width. • Visual Logic provides commands for changing the pen’s color and width.

  8. Set Color and Pen Width • The Set Color command allows the developer to select any color from the standard color dialog box. • The Pen Width command changes the thickness of the drawing pen.

  9. Color Forward • The Color Forward command moves the pen through the three base colors of red, green, and blue. • The Color Forward command typically occurs inside a loop.

  10. 5-3 Structured DesignUsing Procedures • Structured design means a problem is broken into smaller pieces, each of which is solved individually. • A procedure is a series of instructions that are grouped together and treated as a single unit.

  11. 5-3 Structured DesignUsing Procedures (cont.)

  12. Rotating Flags Problem

  13. Rotating Flags Problem (cont.)

  14. 5-4 Procedures with Arguments • An argument (or parameter) is a piece of information that is communicated between the calling code and the procedure. • The argument is referred to as an actual argument at the time of the call and as a formal argument in the called procedure.

  15. Rotating Shapes Program

  16. Visual Logic Implementation

  17. 5-5 Recursion • A recursive procedure is a procedure that calls itself. • To prevent infinite recursion, a recursive procedure typically first performs a test on one of its arguments to check for a base case.

  18. Chapter Summary • Visual Logic graphics include commands, such as Forward and Right, that move a virtual pen across the screen. • Procedures allow code to be written once and called many times. • An actual argument is a value or reference passed from the calling code to a procedure.

  19. 5 Graphics andProcedures Programming Right from the Start with Visual Basic .NET 1/e

More Related