SlideShare a Scribd company logo
5
Most read
8
Most read
12
Most read
Microsoft® Small BasicGraphics WindowEstimated time to complete this lesson: 1 hour
Graphics WindowIn this lesson, you will learn about:Statements using 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.This lesson exposes you to some exciting graphic capabilities offered by Small Basic. You start with a graphics window that you can display by using the GraphicsWindow object.
Properties of the Graphics WindowYou use the GraphicsWindow object to display a graphics window and draw colorful shapes in it. To display the graphics window on your screen, you use the Show operation.Let’s see how to use different properties of the GraphicsWindow object in a program…You can also define the properties of the graphics window, such as its title, height, width, and background color.output
Properties of the Graphics WindowMouseX—You can use this property to find the x-position of the mouse relative to the graphics window.
MouseY—You can use this property to find the y-position of the mouse relative to the graphics window.
PenColor—You can use this property to change the color with which shapes are drawn on the graphics window.
PenWidth—You can use thisproperty to change the width of the pen used to draw shapes on the graphics window.
BrushColor—You can use thisproperty to change the color used to fill shapes drawn on the graphics window.Certain properties of the GraphicsWindow object help you enhance the shapes your create. Some of these properties are:
Operations on the Graphics WindowSome of the operations available for the GraphicsWindow object are:DrawRectangle
DrawEllipse
DrawLine

More Related Content

PDF
How to use Canva
PPTX
PowerPoint Lesson 1: PowerPoint Basics
PPTX
Bootstrap PPT Part - 2
PPTX
Windows form application - C# Training
PPTX
Ms powerpoint 2013
PPTX
PowerPoint basics
PDF
An introduction to MS Publisher
PPT
User Interface
How to use Canva
PowerPoint Lesson 1: PowerPoint Basics
Bootstrap PPT Part - 2
Windows form application - C# Training
Ms powerpoint 2013
PowerPoint basics
An introduction to MS Publisher
User Interface

What's hot (20)

PPSX
Ms publisher parts and functions
PPT
Program design and problem solving techniques
PPT
PPTX
HTML5- Create divisions in a web page
PPTX
Introduction to programming concepts
PPTX
HTML/HTML5
PPTX
How to use Canva in the classroom
PPT
Hyperlinks in HTML
PDF
How to use canva
PPT
MS Publisher.ppt
PPTX
Application development and emerging technologies.pptx
PPT
android menus
PPT
Vb introduction.
PPT
PHP complete reference with database concepts for beginners
PPTX
Introduction to Windows XP
DOCX
Lesson 1 introduction to spreadsheet
PPTX
MS Excel Ch 2 PPT
PPTX
Integrative Programming Technology Chapter 5 - Dr. J. VijiPriya
PPTX
Lecture 1 introduction to computing
Ms publisher parts and functions
Program design and problem solving techniques
HTML5- Create divisions in a web page
Introduction to programming concepts
HTML/HTML5
How to use Canva in the classroom
Hyperlinks in HTML
How to use canva
MS Publisher.ppt
Application development and emerging technologies.pptx
android menus
Vb introduction.
PHP complete reference with database concepts for beginners
Introduction to Windows XP
Lesson 1 introduction to spreadsheet
MS Excel Ch 2 PPT
Integrative Programming Technology Chapter 5 - Dr. J. VijiPriya
Lecture 1 introduction to computing
Ad

Viewers also liked (20)

PPTX
1.1 introduction to small basic
PPTX
1.4 conditions and loops
PPTX
2.3 exploring shapes
PPTX
2.2 turtle graphics
PPT
Basic logo-command
DOC
In-bai tap logo_01 (hsinh)
PPTX
DOC
Msw logo application user manual for teacher
PPT
Logo primitives
DOC
Geometria de las Tortugas
DOC
In-bai tap logo_02 -thu tuc (gv)
PPT
PPTX
4.4 advanced games
PPTX
Unit of measurements
PPTX
2.5 clock, desktop, and dictionary objects
PPTX
1.3 variables
PPTX
1.5 branching and subroutines
PPTX
2.4 sound, program, and text objects
PDF
Guia rápida de comandos de micromundos
PDF
Proyecto 1 en micromundos 24 mar2015
1.1 introduction to small basic
1.4 conditions and loops
2.3 exploring shapes
2.2 turtle graphics
Basic logo-command
In-bai tap logo_01 (hsinh)
Msw logo application user manual for teacher
Logo primitives
Geometria de las Tortugas
In-bai tap logo_02 -thu tuc (gv)
4.4 advanced games
Unit of measurements
2.5 clock, desktop, and dictionary objects
1.3 variables
1.5 branching and subroutines
2.4 sound, program, and text objects
Guia rápida de comandos de micromundos
Proyecto 1 en micromundos 24 mar2015
Ad

Similar to 2.1 graphics window (20)

PPT
Chapter 13
PPTX
1.2 statements, properties, and operations
PPTX
3.5 the controls object
PDF
Mat-lab image processing tatorial
PPTX
COM 211 PRESENTATION.pptx
PPTX
UNIT I.pptx
PDF
borland-style-graphics-for-dev-c.pdf
PPT
Ms vb
PDF
Introduction to MapBasic
DOC
Ex11 mini project
PDF
Introducing small basic
PDF
Introducing small basic
PDF
Introducing Small Basic.pdf
PPT
Csphtp1 02
PPS
Vb6.0 Introduction
PPTX
4.1 playing with shapes
PPTX
Vb6.0 intro
PPT
Unit 2 Graphics and awt.hsjshbshshsbsbsbs.pptx
PPTX
Introduction to visual basic 6 (1)
PPT
Gui Layout Presentation
Chapter 13
1.2 statements, properties, and operations
3.5 the controls object
Mat-lab image processing tatorial
COM 211 PRESENTATION.pptx
UNIT I.pptx
borland-style-graphics-for-dev-c.pdf
Ms vb
Introduction to MapBasic
Ex11 mini project
Introducing small basic
Introducing small basic
Introducing Small Basic.pdf
Csphtp1 02
Vb6.0 Introduction
4.1 playing with shapes
Vb6.0 intro
Unit 2 Graphics and awt.hsjshbshshsbsbsbs.pptx
Introduction to visual basic 6 (1)
Gui Layout Presentation

More from allenbailey (9)

PPTX
5.1 sharing code
PPTX
4.3 collision detection
PPTX
4.2 responding to events
PPTX
3.6 debugging aids
PPTX
3.4 events and interactivity
PPTX
3.3 the math object
PPTX
3.2 stacks and arrays
PPTX
3.1 file input and output
PPTX
2.6 flickr, image list, and network objects
5.1 sharing code
4.3 collision detection
4.2 responding to events
3.6 debugging aids
3.4 events and interactivity
3.3 the math object
3.2 stacks and arrays
3.1 file input and output
2.6 flickr, image list, and network objects

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectral efficient network and resource selection model in 5G networks
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx

2.1 graphics window

  • 1. Microsoft® Small BasicGraphics WindowEstimated time to complete this lesson: 1 hour
  • 2. Graphics WindowIn this lesson, you will learn about:Statements using the GraphicsWindow object.Properties of the GraphicsWindow object.Operations of the GraphicsWindow object.
  • 3. Introducing the Graphics Window So far, you have used the text window to understand the fundamentals of programming using Small Basic.This lesson exposes you to some exciting graphic capabilities offered by Small Basic. You start with a graphics window that you can display by using the GraphicsWindow object.
  • 4. Properties of the Graphics WindowYou use the GraphicsWindow object to display a graphics window and draw colorful shapes in it. To display the graphics window on your screen, you use the Show operation.Let’s see how to use different properties of the GraphicsWindow object in a program…You can also define the properties of the graphics window, such as its title, height, width, and background color.output
  • 5. Properties of the Graphics WindowMouseX—You can use this property to find the x-position of the mouse relative to the graphics window.
  • 6. MouseY—You can use this property to find the y-position of the mouse relative to the graphics window.
  • 7. PenColor—You can use this property to change the color with which shapes are drawn on the graphics window.
  • 8. PenWidth—You can use thisproperty to change the width of the pen used to draw shapes on the graphics window.
  • 9. BrushColor—You can use thisproperty to change the color used to fill shapes drawn on the graphics window.Certain properties of the GraphicsWindow object help you enhance the shapes your create. Some of these properties are:
  • 10. Operations on the Graphics WindowSome of the operations available for the GraphicsWindow object are:DrawRectangle
  • 17. DrawResizedImageYou can use operations along with properties to create colorful shapes in your program.
  • 18. Exploring the Graphics WindowLet’s explore the different properties and operations of the GraphicsWindow object by writing a program to create shapes.output
  • 19. Using Colors in the Graphics WindowYou can use a range of colors in the graphics window to create colorful shapes. Let’s take a look at a few colors supported by Small Basic.You can also choose from a variety of other colors such as pink, orange, yellow, purple, brown, white, and gray.
  • 20. Exploring the Graphics WindowLet’s take a look at another example that explores some more properties and operations of the GraphicsWindow object.The output in this example displays a graphics window with a random-colored barcode-like design, accompanied by a secondary window—a message box.
  • 21. Exploring the Graphics WindowOther operations used by the GraphicsWindow object include DrawImage and DrawResizedImage. Let’s look at an example…The DrawResizedImage operation draws the specified image onto the screen, in the size specified. The DrawImage operation draws the specified image onto the screen.
  • 22. Let’s Summarize…Congratulations! Now you know how to:Write statements relevant to the GraphicsWindow object.Use various properties of the GraphicsWindow object.Perform different operations using the GraphicsWindow object.
  • 23. It’s Time to Apply Your Learning…Write a program to display a graphics window and perform the following steps to explore your creativity:Set the height and width of the graphics window to 640 and 800 pixels, respectively.
  • 24. Insert two differently colored shapes partially overlapping each other.
  • 25. Draw multiple rectangles in random colors.
  • 26. Insert a resized image at a suitable location on the screen.
  • 27. Display a message box with the message "Have a nice day!"

Editor's Notes

  • #9: You can choose from a variety of colors supported by Small Basic, categorized by their base hue. In your code, you can either specify the name of the color, or the hex color code.
  • #10: In addition drawing shapes, you can also create colorful designs in your program by using conditions and loops for your shapes. For example, take a look at the displayed example. You use a For loop to create a barcode-like design with lines. You also use the GetRandomColoroperation to randomize the color of the lines. Another useful operation for the GraphicsWindow object is ShowMessage.WithShowMessage,you can display a message box in your program. You just needto provide two parameters—the message to be displayed and the title for the message box.On clicking the Run button on the toolbar or pressing F5 on the keyboard, the program is executed. Notice that along with your graphics window, a message box is displayed. The graphics window displays the random-colored barcode-like design that we defined in the code.Code:GraphicsWindow.Title = "Graphics Window"GraphicsWindow.BackgroundColor = "White"GraphicsWindow.Width = 325GraphicsWindow.Height = 200For i = 1 To 15GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()GraphicsWindow.PenWidth = iGraphicsWindow.DrawLine(i * 20, 20, i * 20, 180)EndForGraphicsWindow.ShowMessage("Create wonderful designs and shapes in Small Basic", "Message")
  • #11: You can insert images in your program by using the DrawImage operation of the GraphicsWindow object. The parameters for DrawImagerequire the image name, and the x- and y-coordinates of the points where the image is to be drawn. You can also insert resized images in your program by using the DrawResizedImage operation of the GraphicsWindow object. The parameters for DrawResizedImagerequire the image name, and the x- and y-coordinates of the points where the image is to be drawn, and the width and height of the image. You also have to define the image path. If the image is stored on a Web site or server, you can specify the URL. If the image is stored on your computer, simply specify the path to the image.When you click the Run button on the toolbar or press F5 on the keyboard, the program is executed. Notice that your graphics window is displayed, along with the resized image, at the set pixel location.You can also use the SetPixeloperation to draw a pixel on the graphics window at the location specified by the x- and y-coordinates.Code:GraphicsWindow.Title = "Graphics Window"GraphicsWindow.Width = 800GraphicsWindow.Height = 600image1 = "C:Small BasicSunset.jpg"GraphicsWindow.DrawImage(image1, 0, 0)image2 = "C:Small BasicWinter.jpg"GraphicsWindow.DrawResizedImage(image2, 100, 100, 200, 200)
  • #13: Please Note: Ensure that the image exists at the location specified in the code.Solution:  GraphicsWindow.Show()GraphicsWindow.Title = "A Graphics Window"GraphicsWindow.Height = 640GraphicsWindow.Width = 800GraphicsWindow.BackgroundColor = "Black"GraphicsWindow.PenWidth = 10GraphicsWindow.PenColor =GraphicsWindow.PenColor = “Gold"GraphicsWindow.DrawLine(65, 100, 65, 370)GraphicsWindow.PenColor =GraphicsWindow.PenColor = “Black"GraphicsWindow.BrushColor =GraphicsWindow.BrushColor = “Cyan"GraphicsWindow.DrawEllipse(70, 250, 100, 100)GraphicsWindow.FillEllipse(70, 250, 100, 100)For i = 1 To 10GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()GraphicsWindow.PenWidth = 2GraphicsWindow.Drawrectangle(100, i * 20, 50, 10)EndForimage1 = "C:Small BasicWinter.jpg"GraphicsWindow.DrawResizedImage(image1, 200, 100, 500, 500)GraphicsWindow.ShowMessage("Have a nice day!", "Message")