Microsoft® Small Basic

Slides:



Advertisements
Similar presentations
FUN WITH SHAPES INFORMATION PROCESSING 10 MR. MELLESMOEN.
Advertisements

Microsoft FrontPage Monday January 28, The Basic FrontPage Setup.
Microsoft® Small Basic Statements, Properties, and Operations Estimated time to complete this lesson: 1 hour.
Microsoft® Small Basic
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Lesson 15 Presentation Programs.
Chapter 9 Color, Sound and Graphics
Microsoft Office Illustrated Fundamentals Unit N: Polishing and Running a Presentation.
Microsoft® Small Basic
Microsoft® Small Basic Advanced Games Estimated time to complete this lesson: 1 hour.
COMPREHENSIVE Windows Tutorial 3 Personalizing Your Windows Environment.
®® Microsoft Windows 7 Windows Tutorial 3 Personalizing Your Windows Environment.
Chapter 5: Graphics Spotlight on Word ProcessingChapter 51.
Microsoft® Small Basic Clock, Desktop, and Dictionary Objects Estimated time to complete this lesson: 1 hour.
Pasewark & Pasewark 1 Excel Lesson 2 Changing the Appearance of a Worksheet Microsoft Office 2007: Introductory.
Exploring Other FreeHand Features – Lesson 31 Exploring Other FreeHand Features Lesson 3.
FIRST COURSE Excel Tutorial 4 Working with Charts and Graphics.
You can insert graphics onto your page by clicking on the Picture Frame Tool icon and then drawing a frame for your graphic. Double click in the frame.
Sketchify Tutorial Graphics and Animation in Sketchify sketchify.sf.net Željko Obrenović
Roentgen photo effect. This detailed, thoroughly explained lesson will show you how to create very attractive roentgen photo effect. You can use this.
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
Reporting Aesthetics An ACEware Webinar 1:00-2:00 pm February 14 th, 2008.
Microsoft® Small Basic Clock, Desktop, and Dictionary Objects Estimated time to complete this lesson: 1 hour.
Microsoft® Small Basic The Controls Object Estimated time to complete this lesson: 1 hour.
1 Word Lesson 4 Working with Graphic Objects Microsoft Office 2010 Fundamentals Story / Walls.
Tutorial 3: Working with Images. Objectives Session 3.1 – Identify the differences among image file types – Evaluate the purpose of alternative text –
XP Tutorial 7 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Working with Graphics Tutorial 7.
Microsoft® Small Basic
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® Excel 2010 © 2011 The McGraw-Hill Companies,
CIS 205—Web Design & Development Flash Chapter 1 Getting Started with Adobe Flash CS3.
Adobe Dreamweaver CS3 Revealed CHAPTER FIVE: USING HTML TABLES TO LAY OUT A PAGE.
Power Point Presentations A Step by Step Guide. Contents The very first step Choosing slide layout Adding text boxes Custom Animation Changing slide design.
Microsoft® Small Basic
PowerPoint: Working with Slides Lecture 7-2 CMPSC 100 Spring 2004 Penn State University Doug Hogan.
Screen ViewModule Title: Notes: Branching Instructions: Audio Script: Page: Use Microsoft Outlook 1 Create a Distribution List A distribution list is a.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved CheckWriter Application Introducing Graphics and Printing.
Excel – Lesson 2 Excel Lesson 2 Changing the Appearance of a Worksheet Microsoft Office 2007: Introductory Pasewark & Pasewark 1.
Inserting a text box Inserting a text box (1 of 3) 1. Click on Insert. 2. Click Text box. 2 1.
Working with Graphics – Lesson 21 Working with Graphics Lesson 2.
MS Word Lesson Nine Formatting Objects Mrs. Brown.
1 After completing this lesson, you will be able to: Plan a FrontPage Web site. Create a new Web. Create a subpage layout. Use the subpage layout to build.
Microsoft® Small Basic Collision Detection Estimated time to complete this lesson: 1 hour.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
CRSD Technology Training Tony Judice. Quick Access Toolbar – can be modifiedSave as… allows you to save the file to a different location and also as an.
1 Excel Lesson 1 Microsoft Excel Basics Microsoft Office 2010 Pasewark & Pasewark.
Working with Shapes Guided Lesson. Objective  In this lesson you will learn how to insert a shape and format it by changing its fill color, outline color,
Microsoft® Small Basic Exploring Shapes Estimated time to complete this lesson: 1 hour.
CRE Programming Club - Class 5 Robert Eckstein and Robert Heard.
Images Part 11 dbg. 2 Images The form and several controls can display a number of different types of image files in the BackgroundImage Property. These.
Adobe InDesign CS5 – Illustrated Unit C: Working with Objects.
Microsoft® Small Basic Flickr, ImageList, and Network Objects Estimated time to complete this lesson: 1 hour.
PhotoShop Creative Suite 3 Chapter 1 The Work Area.
Enhancing a Presentation with Pictures, Shapes, and WordArt
Lesson 18 Graphics and Charts. Overview Insert clip art. Move and format clip art. Create WordArt. Create text boxes. Create shapes. Creating diagrams.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Creating a Navigation Bar.
Chapter 10 Creating a Template for an Online Form Microsoft Word 2013.
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Windows Tutorial 3 Personalizing Your Windows Environment
Introduction to Microsoft publisher
Introduction to Microsoft publisher
Microsoft® Small Basic
A Tiny Look at the Graphics Window
Basic Graphics Drawing Shapes 1.
Microsoft® Small Basic
Microsoft® Small Basic
Microsoft® Small Basic
Otasuke GP-EX! Chapter 1 Menu Screen.
A Tiny Look at the Graphics Window
Chapter 1 Introducing Small Basic
Lesson 4 Graphics in Publications
Presentation transcript:

Microsoft® Small Basic Graphics Window Estimated time to complete this lesson: 1 hour

Graphics Window In this lesson, you will learn about: Statements that use the GraphicsWindow object. Properties of the GraphicsWindow object. Operations of the GraphicsWindow object.

Introducing the Graphics Window So far, you have used the text window to understand the fundamentals of programming using Small Basic. In this lesson, you discover some exciting graphic capabilities that Small Basic offers. You start with a graphics window that you can display by using the GraphicsWindow object.

Properties of the Graphics Window You can display a graphics window and draw colorful shapes in it if you use the Show operation of the GraphicsWindow object. output You can also specify properties of the graphics window, such as its title, height, width, and background color. You can display the graphics window by typing the statement GraphicsWindow.Show() in the editor window. Similarly, you can hide the graphics window by using the GraphicsWindow.Hide() statement. You can also modify the look and feel of the graphics window by specifying a range of properties. For example, you can set its title by using the Title property of the GraphicsWindow object. Similarly, you can modify the height, width, and background color of the graphics window by specifying the Height, Width, and BackgroundColor properties, respectively. When you run the program below, a graphics window appears with the properties that you specified, instead of the black text window. Code: GraphicsWindow.Show() GraphicsWindow.Title = "A Graphics Window" GraphicsWindow.Height = 300 GraphicsWindow.Width = 350 GraphicsWindow.BackgroundColor = "Cyan" Let’s see how to use different properties of the GraphicsWindow object in a program…

Properties of the Graphics Window You can enhance the shapes that you create if you specify certain properties of the GraphicsWindow object. These properties include the following: PenColor—By specifying this property, you can draw shapes whose borders are whatever colors you choose. PenWidth—By specifying this property, you can draw shapes whose borders are whatever thickness you choose. BrushColor—By specifying this property, you can fill the shapes that you draw with whatever colors you choose. You can use some properties and operations of the GraphicsWindow object only for displaying shapes, but you can use other properties (such as MouseX and MouseY) when you work with mouse and keyboard actions in your program. You will learn more about these properties, along with events and interactivity in Small Basic, later in the curriculum. Code: GraphicsWindow.PenColor = "Purple" GraphicsWindow.PenWidth = 3 GraphicsWindow.BrushColor = "Green" x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY MouseX—By specifying this property, you can find the horizontal position of the mouse. MouseY—By specifying this property, you can find the vertical position of the mouse.

Operations on the Graphics Window You can create colorful shapes in your program by using operations and their properties. This list shows some of the operations that you can use for the GraphicsWindow object: DrawRectangle DrawEllipse DrawLine FillRectangle GetRandomColor SetPixel ShowMessage DrawResizedImage

Exploring the Graphics Window By writing a program to create shapes, you can explore the different properties and operations of the GraphicsWindow object. output In this example: You start by setting the title, the width, and the height of the graphics window. When you set the width and the height, make sure to specify an area that is large enough to hold all of the shapes that you want to draw. You then use the PenColor and PenWidth properties to specify the border color and border thickness of the first shape that you want to draw. You can also use these properties later to specify a different border color and border thickness for your next shape. To draw a rectangle, you use the DrawRectangle operation, and you specify its parameters, which are values that determine how the rectangle looks. These parameters include not only the x-coordinate and the y-coordinate of the rectangle, which determine the location of its upper-left corner, but also the width and the height of the rectangle, which determine its size and proportions. To fill the rectangle with a color, you use the FillRectangle operation, and you specify the same parameters as you specified for the DrawRectangle operation. If you do not specify a fill color with the BrushColor property, the shape is filled with slate blue, as the output shows. To draw an ellipse and fill it with a different color, you specify the color by using the BrushColor property, draw the ellipse by using the DrawEllipse operation, and fill the ellipse with the FillEllipse operation. Just as you did with the DrawRectangle operation, you specify parameters that determine the location, size, and shape of the ellipse. For example, you can draw a circle by specifying the same value for the width and height of the ellipse. You should specify the same values for the parameters of the FillEllipse operation as you did for the DrawEllipse operation. To draw a line, you specify the color of the line by using the PenColor property, and you specify the location, length, and angle of the line by using the DrawLine operation and its parameters. To specify the parameters of the DrawLine operation, you must include the x-coordinate and the y-coordinate of one end of the line and the x-coordinate and the y-coordinate of the other end of the line. To check the output of your program, click Run on the toolbar, or press F5 on the keyboard. Shapes that appear in the graphics window reflect the type, size, location, and colors that you specified in your code. Code: GraphicsWindow.Title = "Graphics Window" GraphicsWindow.Height = 300 GraphicsWindow.Width = 300 GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 3 GraphicsWindow.DrawRectangle(70, 60, 100, 150) GraphicsWindow.FillRectangle(70, 60, 100, 150) GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawEllipse(200, 150, 50, 100) GraphicsWindow.FillEllipse(200, 150, 50, 100) GraphicsWindow.PenColor = "Gold" GraphicsWindow.DrawLine(10, 200, 250, 200)

Using Colors in the Graphics Window You can use a range of colors in the graphics window to create colorful shapes. Let’s look at a few of the colors that Small Basic supports. You can also choose from a variety of other colors that include pink, orange, yellow, purple, brown, white, and gray. You can choose from a variety of colors that Small Basic supports. In this slide, the colors are categorized by their base hue. In your code, you can specify the color by either its name or its color code, which is a hexadecimal (base 12) number.

Exploring the Graphics Window Let’s look at an example that explores more properties and operations of the GraphicsWindow object. This example displays a message box, which contains text and an OK button, and a graphics window, which contains a design like a barcode with random colors. In addition to drawing shapes, you can also create colorful designs by using conditions and loops. In this example, you create a barcode-like design with lines by using a For loop. You also randomize the colors of the lines by using the GetRandomColor operation. You can display a message box in your program by using the ShowMessage operation of the GraphicsWindow object. For this operation, you must provide only two parameters—the message that appears in the box and the title that appears at the top of the message box. To run the program, you click Run on the toolbar, or you press F5 on the keyboard. Code: GraphicsWindow.Title = "Graphics Window" GraphicsWindow.BackgroundColor = "White" GraphicsWindow.Width = 325 GraphicsWindow.Height = 200 For i = 1 To 15 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.PenWidth = i GraphicsWindow.DrawLine(i * 20, 20, i * 20, 180) EndFor GraphicsWindow.ShowMessage("Create wonderful designs and shapes in Small Basic", "Message")

Exploring the Graphics Window You can display images by using the DrawImage and DrawResizedImage operations of the GraphicsWindow object. Let’s look at an example… For the DrawImage operation, you specify only the file name of the image and the location on the screen where you want the image to appear. For both the DrawImage and DrawResizedImage operations, you must specify not only the file name of the image that you want to display but also its path. If the file is stored on your computer, you can specify the local path. If the file is stored on a website or network server, you can specify the URL or absolute path. The images in this example are provided with Small Basic and are stored on your computer. You must also specify the location where the image or resized image will appear on the screen, and you specify that location by including the x-coordinate and the y-coordinate of the upper-left corner of the image. For the DrawResizedImage operation only, you specify how big you want the image to appear by including the new width and height of the image. To run your program and display your images, you click Run on the toolbar, or you press F5 on the keyboard. You can also use the SetPixel operation to draw a pixel in the graphics window at the location that you specify by including its x-coordinate and its y-coordinate. Code: GraphicsWindow.Title = "Graphics Window" GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 image1 = "C:\Small Basic\Sunset.jpg" GraphicsWindow.DrawImage(image1, 0, 0) image2 = "C:\Small Basic\Winter.jpg" GraphicsWindow.DrawResizedImage(image2, 100, 100, 200, 200) For the DrawResizedImage operation, you specify the file name, the location on the screen, and the new size of the image.

Let’s Summarize… Congratulations! Now you know how to: Show and hide the GraphicsWindow object. Draw shapes and lines in the GraphicsWindow object. Display images in the GraphicsWindow object.

Show What You Know Explore your creativity by writing a program that displays a graphics window and performs the following steps: Displays a graphics window that is 640 pixels tall and 800 pixels wide. Shows two shapes that are of different colors and that partially overlap each other. Shows multiple rectangles in random colors. Shows a resized image at a suitable location on the screen. Shows a message box that contains the message "Have a nice day!" Ensure that you specify the correct path and file name for the image that you want to display. Solution:    GraphicsWindow.Show() GraphicsWindow.Title = "A Graphics Window" GraphicsWindow.Height = 640 GraphicsWindow.Width = 800 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenWidth = 10 GraphicsWindow.PenColor = "Gold" GraphicsWindow.DrawLine(65, 100, 65, 370) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Cyan" GraphicsWindow.DrawEllipse(70, 250, 100, 100) GraphicsWindow.FillEllipse(70, 250, 100, 100) For i = 1 To 10 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.PenWidth = 2 GraphicsWindow.Drawrectangle(100, i * 20, 50, 10) EndFor image1 = "C:\Small Basic\Winter.jpg" GraphicsWindow.DrawResizedImage(image1, 200, 100, 500, 500) GraphicsWindow.ShowMessage("Have a nice day!", "Message")