Class Session Notes


Index > Microsoft Small Basic

Session I: 04 February 2017


Introduction

Microsoft Small Basic is an elementary-level programming language designed to assist people who wish to begin learning how to write code. This programming language resembles Visual Basic in the syntax in which it is written, but is designed to allow users to draw and animate shapes and objects out of the box. The programs you create in Small Basic can be compiled into a single executable, which you can then easily share with your friends as you please.


If you don't have Small Basic, don't worry. You can download it for free here. Also, feel free to copy and paste any code examples on this page into your code editor and run the code to see what it does.


Project 1: Wallpaper Switcher

We began exploring Small Basic as an introduction to programming. In doing so, we created one of the easiest projects possible in Small Basic: a wallpaper changer. Small Basic enables us to change the desktop wallpaper in as few as four lines of code, using a class which pulls random photos from Flickr, Yahoo's photo sharing database.


Code Example

For i = 1 To 5 Desktop.SetWallPaper(Flickr.GetRandomPicture("Nintendo"))
Program.Delay(5000) ' Wait 5 seconds (5000 milliseconds)
EndFor

Project 2: Travelling Rectangle

We wrote another program in Small Basic which entailed the graphics UI portion of the development environment. This program involved several more lines of code, but it demonstrates how you can draw shapes on the screen and animate them as you like, without the need for a large amount of code to perform such task.


Code Example

maxWidth = Desktop.Width
maxHeight = Desktop.Height
GraphicsWindow.Width = maxWidth / 2
GraphicsWindow.Height = maxHeight / 2
GraphicsWindow.BackgroundColor = "White"
shp = Shapes.AddRectangle(200, 100)
Shapes.Animate(shp, 400, 200, 500)

Questions?

If you have any questions, please send us an email at compcademy@outlook.com.