In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

Size: px
Start display at page:

Download "In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics."

Transcription

1 Additional Controls, Scope, Random Numbers, and Graphics CS109 In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Combo Box The Combo Box control is like a textbox with a pull-down menu of choices. We can access the user s selection with: combobox.text We can add to the items just like with a listbox: combobox.items.add(newitem) (Short demo in class) Group Box Control The group box is used to group related sets of controls for visual effect. To use it, drag the group box onto the form. Then drag any new controls into the group box. The new controls will now be part of the group box. The group box can be used to create different sets of radio buttons (upcoming). (Short demo in class) Check Box Control The checkbox is a small box that can be checked or unchecked by the user. To see if something is checked or not you can inspect the Checked Property: checkbox.checked - True if checked, False if not (Short demo in class) Radio Button Control The radio button operates like an old car radio. When one button is pushed, any other buttons pop out. For all radio buttons that are on a form, only one can be active at a time. If you would like to have multiple subgroups of radio buttons then they should be added to a GroupBox.

2 To see the value of a radio button, you can inspect the.checked property just as with a checkbox. (Short demo in class) Main Menu Control This control allows you to add a menu to the application. To use it, drag a Main Menu control to your form. Then double-click it in the form area. A menu designer will appear at the top of your form saying Type Here. You can now type the name of the top-level of your menu. Click and type to fill in sub-areas. To attach code to the sub-areas, double-click on the menu item. The VB Code window will appear with an event for you to fill in code. Try adding a menu for F)ile, O)pen, and C)lose. Variable Scope Scope refers to the section of code where a variable is alive. There are two categories of scope for a variable in C# that are generally used: class scope and local scope. Both adhere to the same basic rule: a variable is accessible everywhere within the curly braces where it is declared, including code within nested subroutines. Local Variables A local variable only has scope within the method in which it is created. When a variable is declared within a method, space reserved in memory for that variable exists until the subroutine exits, at which point the variable ceases to exist private void button1_click(object sender, EventArgs e) int num = 3; // Local variable, reset to 3 when run num = num + 5; MessageBox.Show(num.ToString()); // Shows 8 every time Your program is free to have other subroutines that use the variable num and each will refer to a different number. Class Variables Class level variables are visible to every method in the class. These variables are declared within the class but outside all methods within that class. This is useful for variables you would like to use within many methods on the form.

3 public partial class Form1 : Form string strname; private void button1_click(object sender, EventArgs e) strname = "Milhouse"; private void button2_click(object sender, EventArgs e) Console.WriteLine(strName); This technique is also a way in which subroutines can send data to each other one subroutine can set the class level variable while the other reads it. In this case, strname is set in button1 s click event, and displayed in button2 s click event. If you click button 2 before button 1, then a blank string is output (the default value for strname). In normal usage, variable scoping is as simple as defined above. However, things get trickier when variables have the same name. For example, consider the following scenario: public partial class Form1 : Form string strname = "Hello"; private void button2_click(object sender, EventArgs e) string strname = "There"; Console.WriteLine(strName); In the example above we have two variables named strname. One has class scope, the other has local scope. Which variable is referenced when there is this ambiguity? The rule used in C# is that local variables take precedence over class variables. In the example above, the local variable value of There is output.

4 If we wanted to access the class or module level variable, use the keyword this in front of the variable name: public partial class Form1 : Form string strname = "Hello"; private void button2_click(object sender, EventArgs e) string strname = "There"; Console.WriteLine(this.strName); It is common convention to always use the this prefix for class level variables. Once again, this example only demonstrates output of a variable, but we could also assign the class or local variable to a different value. C# does not allow us to have multiple local variables with the same name within the same scope. The following is illegal; private void button2_click(object sender, EventArgs e) string strname = "There"; Console.WriteLine(strName); string strname = "Hello"; Console.WriteLine(strName); // Illegal redefinition Random Numbers It is often useful to generate random numbers to produce simulations or games (or homework problems :) One way to generate these numbers in C# is to use the Random object. The random object generates pseudo-random numbers. What is a pseudo-random number? It is a number that is not truly random, but appears random. That is, every number between 0 and 1 has an equal chance (or probability) of being chosen each time random() is called. (In reality, this is not the case, but it is close). Here is a very simple pseudorandom number generator to compute the ith random #: R i = (R i-1 * 7) mod 11 Initially, we set the seed, R 0 = 1. Then our first random number is 7 mod 11 or 7. Our second random number is then (7*7) mod 11 or 5. Our third random number is then (5*7) mod 11 or 3. Our fourth random number is then (3*7) mod 11 or 10...etc.

5 As you can see, the values we get seem random, but are really not. This is why they are called pseudorandom. We can get slightly more random results by making the initial seed some variable number, for example, derived from the time of day. The particular function shown above would not be a very good pseudorandom number generator because it would repeat numbers rather quickly. Here is an example of using C# s random number generator. 1. At the class level, create a variable of type Random: Random rnd = new Random(); This creates a new Random object. We ll talk more about objects later when we get to object-oriented programming. We need to create the random number only once or we won t get a good pseudorandom number sequence. A good way to do this is to make it a class level variable associated with your form (this it will be created once when the form is displayed). 2. To generate a random integer x, where min x < max, use: x = rnd.next(min, max); 3. To generate a random double d, where 0 d < 1, use: d = rnd.nextdouble(); Here is a short demonstration program: public partial class Form1 : Form Random rnd = new Random(); public Form1() InitializeComponent(); private void button1_click(object sender, EventArgs e) int intnum; double dblnum; intnum = rnd.next(0, 4); Console.WriteLine(intNum); dblnum = rnd.nextdouble(); Console.WriteLine(dblNum);

6 The program above might print out: The second time the button is clicked it might print out: Both the integer and double are randomly generated. While the method call allows us to specify the range for integers, what if instead we wanted a random double between 5 and 15? We can just invoke rnd with: intnum = rnd.next(5, 16) This generates a number that is 5 and < 16 (i.e inclusive). Drawing Graphics Generally, you will use the PictureBox control to display graphics. It can display shapes we draw ourselves and also common image formats such as JPG, GIF, BMP, PNG, etc. We already showed how to display a static image (just add a picturebox to the form, click on the image property, Import a local resource, and pick the file that corresponds to the image you want displayed). Drawing Line Graphics To experiment with drawing graphics within a picturebox, add a PictureBox control to the form. In the Visual Studio Code section, go to the events for the PictureBox and select the Paint event: The Paint event is automatically invoked whenever the PictureBox needs to be redrawn. For example, if the form is minimized, dragged, or occluded, then when the form is activated the Paint event will be invoked. By placing the drawing code in the Paint event it will always be updated correctly. If we placed the code somewhere else and the window was obscured, it may not be redrawn correctly when the obscuring item is moved out of the way. We can now put code in the Paint event that will draw whatever we like on top of the PictureBox. The graphics screen is set up as a grid of pixels where the upper left coordinate is 0,0. This is relative to where the PictureBox is on the form. The x coordinate then grows out to the right, and the y coordinate grows down toward the bottom. For example, in the picture below the white pixel is at coordinate (600,400).

7 (0,0) x y (600, 400) Here is some sample code we can add to the Paint event to draw various shapes on the screen: private void picturebox1_paint(object sender, PaintEventArgs e) // Get the graphics object for the event (i.e. the PictureBox) Graphics g = e.graphics; // Draw a red rect of width 1 at Width=50, Height=80 at coord 10,20 g.drawrectangle(pens.red, 10, 20, 50, 80); // Make a new pen of width 4 Pen thickpurplepen = new Pen(Color.Purple, 4); // Ellipse in purple, width 4, within bounding rectangle at 50,10 g.drawellipse(thickpurplepen, 50, 10, 40, 30); // Draw a line from 10,10 to 50,50 of width 1 g.drawline(pens.mediumseagreen, 10, 10, 50, 50); // To fill in a shape we must use a brush SolidBrush bru = new SolidBrush(Color.GreenYellow); // Fill in the rectangle g.fillrectangle(brushes.greenyellow, 100, 100, 50, 20); // Draw part of a pie g.fillpie(brushes.indianred, 130, 20, 100, 100, 30, 60); // Draw the text "Abstract Art" in font Arial, size 12, in Indigo g.drawstring("abstract Art", new System.Drawing.Font("Arial", 12), Brushes.Indigo, 50, 140); First, we capture the Graphics object from the event arguments. The Graphics object is required to draw graphics on the screen. Remember that everything will be drawn relative to the upperleft corner of the PictureBox. Next, we create a red pen and draw a rectangle using that pen. The rectangle takes the coordinates of the upper left corner then the width and height.

8 An ellipse is drawn in a similar fashion, by specifying the bounding rectangle that holds the ellipse. This time we create a new pen object. The new pen object can specify the width of the item to draw. Next we draw a single line using the MediumSeaGreen pen. Next we draw a solid rectangle using a Brush object. The Brush in this case is a solid color, but it is possible to create brushes that are hatched, texture, etc. Finally we draw part of a Pie slice using a red brush. Finally we draw text toward the bottom of the screen using DrawString. You can pick whichever font you like that is on the system. The picture created is shown below: There are many other drawing tools available; see the online help for more details. Note that we should always draw the items in the Paint event, or the items won t be refreshed properly if the screen needs to be re-drawn. For example, if the above code was placed in a Button Click event, the items would be drawn when the button is clicked but not when the form needs to be refreshed. Colors There are lots of different pre-defined colors available from the Color object, e.g.: Color.Black Color.DarkGray Color.Gray Color.Blue Color.Green Color.LightGray Color.Cyan Color.Magenta Color.Orange Color.Pink Color.Red Color.White To create our own color, we can specify the color we want in RGB (red, green, blue). To do this, use: Color.FromArgb(Red, Green, Blue)

9 where Red, Green, and Blue are values in the range is the darkest intensity of each color and 255 is the brightest intensity of that color. The colors are mixed somewhat like the colors that make up light, e.g. red + green = yellow. For example: Color.FromArgb(0,255,200); Creates a green-blue color, with stronger green than blue. There is no red since its value is 0. In-Class Exercise: Random rectangles Write a program so that each time a button is pressed, the picturebox on the form displays a rectangle with a random width between (10-400) and a random height between (10-400) in a random color (SolidBrush) in a random position. Use picturebox1.height and picturebox1.width to get the width and height of the picturebox in pixels. Rnd.next(X,Y) gives a random integer between X and Y. To force the picturebox to update itself, inside the button click event add the code: PictureBox1.Invalidate() This invokes the Paint subroutine for PictureBox1 and it will re-draw itself by executing the code in the Paint event.

(0,0) (600, 400) CS109. PictureBox and Timer Controls

(0,0) (600, 400) CS109. PictureBox and Timer Controls CS109 PictureBox and Timer Controls Let s take a little diversion and discuss how to draw some simple graphics. Graphics are not covered in the book, so you ll have to use these notes (or the built-in

More information

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root);

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root); Intro to Drawing Graphics To draw some simple graphics, we first need to create a window. The easiest way to do this in the current version of Java is to create a JavaFX application. Previous versions

More information

public static void main(string[] args) { GTest mywindow = new GTest(); // Title This program creates the following window and makes it visible:

public static void main(string[] args) { GTest mywindow = new GTest(); // Title This program creates the following window and makes it visible: Basics of Drawing Lines, Shapes, Reading Images To draw some simple graphics, we first need to create a window. The easiest way to do this in the current version of Java is to create a JFrame object which

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

Instructions for Crossword Assignment CS130

Instructions for Crossword Assignment CS130 Instructions for Crossword Assignment CS130 Purposes: Implement a keyboard interface. 1. The program you will build is meant to assist a person in preparing a crossword puzzle for publication. You have

More information

Smoother Graphics Taking Control of Painting the Screen

Smoother Graphics Taking Control of Painting the Screen It is very likely that by now you ve tried something that made your game run rather slow. Perhaps you tried to use an image with a transparent background, or had a gazillion objects moving on the window

More information

We will start our journey into Processing with creating static images using commands available in Processing:

We will start our journey into Processing with creating static images using commands available in Processing: Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find

More information

CSC System Development with Java Introduction to Java Applets Budditha Hettige

CSC System Development with Java Introduction to Java Applets Budditha Hettige CSC 308 2.0 System Development with Java Introduction to Java Applets Budditha Hettige Department of Statistics and Computer Science What is an applet? applet: a Java program that can be inserted into

More information

Class Test 5. Create a simple paint program that conforms to the following requirements.

Class Test 5. Create a simple paint program that conforms to the following requirements. Class Test 5 Question 1 Use visual studio 2012 ultimate to create a C# windows forms application. Create a simple paint program that conforms to the following requirements. The control box is disabled

More information

Painting your window

Painting your window The Paint event "Painting your window" means to make its appearance correct: it should reflect the current data associated with that window, and any text or images or controls it contains should appear

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

Variables, Types, and Expressions

Variables, Types, and Expressions Variables, Types, and Expressions Announcements Karel the Robot due right now. Email: Due Sunday, January 22 at 11:59PM. Update to assignment due dates: Assignments 2 5 going out one day later. Contact

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

CSE 142 Su01 Midterm 1 Sample Solution page 1 of 5

CSE 142 Su01 Midterm 1 Sample Solution page 1 of 5 CSE 142 Su01 Midterm 1 Sample Solution page 1 of 5 Answer all of the following questions. READ EACH QUESTION CAREFULLY. Answer each question in the space provided on these pages. Budget your time so you

More information

1 Getting started with Processing

1 Getting started with Processing cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points Assignment 1 Lights Out! in C# GUI Programming 10 points Introduction In this lab you will create a simple C# application with a menu, some buttons, and an About dialog box. You will learn how to create

More information

public class Foo { private int var; public int Method1() { // var accessible anywhere here } public int MethodN() {

public class Foo { private int var; public int Method1() { // var accessible anywhere here } public int MethodN() { Scoping, Static Variables, Overloading, Packages In this lecture, we will examine in more detail the notion of scope for variables. We ve already indicated that variables only exist within the block they

More information

Chapter 13. Graphics, Animation, Sound and Drag-and-Drop The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 13. Graphics, Animation, Sound and Drag-and-Drop The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 13 Graphics, Animation, Sound and Drag-and-Drop McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives - 1 Use Graphics methods to draw shapes, lines, and filled

More information

Appendix F: Java Graphics

Appendix F: Java Graphics Appendix F: Java Graphics CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Appendix F: Java Graphics CS 121 1 / 15 Topics Graphics and Images Coordinate

More information

Menus. You ll find MenuStrip listed in the Toolbox. Drag one to your form. Where it says Type Here, type Weather. Then you ll see this:

Menus. You ll find MenuStrip listed in the Toolbox. Drag one to your form. Where it says Type Here, type Weather. Then you ll see this: Menus In.NET, a menu is just another object that you can add to your form. You can add objects to your form by drop-and-drag from the Toolbox. If you don t see the toolbox, choose View Toolbox in the main

More information

CS Problem Solving and Object-Oriented Programming

CS Problem Solving and Object-Oriented Programming CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Casual Dinner for Women in CS Next Thursday, January 24 in Gates 219 at 6:00PM. Good food, great company, and everyone is invited! RSVP through email link (sent out earlier

More information

Capturing the Mouse. Dragging Example

Capturing the Mouse. Dragging Example Capturing the Mouse In order to allow the user to drag something, you need to keep track of whether the mouse is "down" or "up". It is "down" from the MouseDown event to the subsequent MouseUp event. What

More information

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet NAME: NAME: Part 1.1 Part 1.2 Part 1.3 Part 2.1 Part 2.2 Part 3.1 Part 3.2 Sign-Off Milestone

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

Your First Windows Form

Your First Windows Form Your First Windows Form From now on, we re going to be creating Windows Forms Applications, rather than Console Applications. Windows Forms Applications make use of something called a Form. The Form is

More information

c.def (pronounced SEE-def) Language Reference Manual

c.def (pronounced SEE-def) Language Reference Manual c.def (pronounced SEE-def) Macromedia Flash TM animation language Language Reference Manual Dennis Rakhamimov (dr524@columbia.edu), Group Leader Eric Poirier (edp29@columbia.edu) Charles Catanach (cnc26@columbia.edu)

More information

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK. Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK. Before you start - download the game assets from above or on MOOICT.COM to

More information

Chapter 13. Graphics, Animation, Sound, and Drag-and-Drop. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

Chapter 13. Graphics, Animation, Sound, and Drag-and-Drop. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 13 Graphics, Animation, Sound, and Drag-and-Drop McGraw-Hill Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Objectives (1 of 2) Use Graphics methods to draw shapes, lines,

More information

Appendix F: Java Graphics

Appendix F: Java Graphics Appendix F: Java Graphics CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Appendix F: Java Graphics CS 121 1 / 1 Topics Graphics and Images Coordinate

More information

Expressions, Statements, and Control Structures

Expressions, Statements, and Control Structures Expressions, Statements, and Control Structures Announcements Assignment 2 out, due next Wednesday, February 1. Explore the Java concepts we've covered and will be covering. Unleash your creative potential!

More information

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM Objectives The objectives of this assignment are: to get your first experience with Java to become familiar with Eclipse Java

More information

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Graphics & Applets CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Back to Chapter

More information

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports Instructor s Programming Logic Printing Reports Programming Logic Quick Links & Text References Printing Custom Reports Printing Overview Page 575 Linking Printing Objects No book reference Creating a

More information

Creating Vector Shapes Week 2 Assignment 1. Illustrator Defaults

Creating Vector Shapes Week 2 Assignment 1. Illustrator Defaults Illustrator Defaults Before we begin, we are going to make sure that all of us are using the same settings within our application. For this class, we will always want to make sure that our application

More information

Visual C# Program: Temperature Conversion Program

Visual C# Program: Temperature Conversion Program C h a p t e r 4B Addendum Visual C# Program: Temperature Conversion Program In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Writing a

More information

Shadows in the graphics pipeline

Shadows in the graphics pipeline Shadows in the graphics pipeline Steve Marschner Cornell University CS 569 Spring 2008, 19 February There are a number of visual cues that help let the viewer know about the 3D relationships between objects

More information

Lecture 8: Images. CS 383 Web Development II Monday, February 19, 2018

Lecture 8: Images. CS 383 Web Development II Monday, February 19, 2018 Lecture 8: Images CS 383 Web Development II Monday, February 19, 2018 Images We can dynamically create images in PHP through the GD library o GD originally stood for gif draw o At one point, GIF support

More information

In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite.

In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite. Drawing Program In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite. 2. Create a new sprite. 3. The new sprite

More information

Create your own Meme Maker in C#

Create your own Meme Maker in C# Create your own Meme Maker in C# This tutorial will show how to create a meme maker in visual studio 2010 using C#. Now we are using Visual Studio 2010 version you can use any and still get the same result.

More information

We ve covered enough material so far that we can write very sophisticated programs. Let s cover a few more examples that use arrays.

We ve covered enough material so far that we can write very sophisticated programs. Let s cover a few more examples that use arrays. Arrays Part 2 We ve covered enough material so far that we can write very sophisticated programs. Let s cover a few more examples that use arrays. First, once in a while it may be useful to be able to

More information

Step 1: Create A New Photoshop Document

Step 1: Create A New Photoshop Document Snowflakes Photo Border In this Photoshop tutorial, we ll learn how to create a simple snowflakes photo border, which can be a fun finishing touch for photos of family and friends during the holidays,

More information

Creating Breakout - Part 2

Creating Breakout - Part 2 Creating Breakout - Part 2 Adapted from Basic Projects: Game Maker by David Waller So the game works, it is a functioning game. It s not very challenging though, and it could use some more work to make

More information

The Fundamentals. Document Basics

The Fundamentals. Document Basics 3 The Fundamentals Opening a Program... 3 Similarities in All Programs... 3 It's On Now What?...4 Making things easier to see.. 4 Adjusting Text Size.....4 My Computer. 4 Control Panel... 5 Accessibility

More information

SFPL Reference Manual

SFPL Reference Manual 1 SFPL Reference Manual By: Huang-Hsu Chen (hc2237) Xiao Song Lu(xl2144) Natasha Nezhdanova(nin2001) Ling Zhu(lz2153) 2 1. Lexical Conventions 1.1 Tokens There are six classes of tokes: identifiers, keywords,

More information

Course 2DCis: 2D-Computer Graphics with C# Chapter C1: The Intro Project

Course 2DCis: 2D-Computer Graphics with C# Chapter C1: The Intro Project 1 Course 2DCis: 2D-Computer Graphics with C# Chapter C1: The Intro Project Copyright by V. Miszalok, last update: 09-12-2007 An empty window DrawString: Hallo World Print window size with color font Left,

More information

An Introduction to Processing

An Introduction to Processing An Introduction to Processing Creating static drawings Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list Coordinate System in Computing.

More information

Now it only remains to supply the code. Begin by creating three fonts:

Now it only remains to supply the code. Begin by creating three fonts: Owner-Draw Menus Normal menus are always drawn in the same font and the same size. But sometimes, this may not be enough for your purposes. For example, here is a screen shot from MathXpert: Notice in

More information

Course 2DCis: 2D-Computer Graphics with C# Chapter C1: Comments to the Intro Project

Course 2DCis: 2D-Computer Graphics with C# Chapter C1: Comments to the Intro Project 1 Course 2DCis: 2D-Computer Graphics with C# Chapter C1: Comments to the Intro Project Copyright by V. Miszalok, last update: 04-01-2006 using namespaces //The.NET Framework Class Library FCL contains

More information

Java TM Applets. Rex Jaeschke

Java TM Applets. Rex Jaeschke Java TM Applets Rex Jaeschke Java Applets 1997 1998, 2009 Rex Jaeschke. All rights reserved. Edition: 3.0 (matches JDK1.6/Java 2) All rights reserved. No part of this publication may be reproduced, stored

More information

PyGame Unit ?

PyGame Unit ? PyGame Unit 1 1.1 1.? 1.1 Introduction to PyGame Text Book for Python Module Making Games With Python and PyGame By Al Swiegert Easily found on the Internet: http://inventwithpython.com/pygame/chapters

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

Visual Basic Course Pack

Visual Basic Course Pack Santa Monica College Computer Science 3 Visual Basic Course Pack Introduction VB.NET, short for Visual Basic.NET is a language that was first introduced by Microsoft in 1987. It has gone through many changes

More information

Visual C# Program: Resistor Sizing Calculator

Visual C# Program: Resistor Sizing Calculator C h a p t e r 4 Visual C# Program: Resistor Sizing Calculator In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor

More information

PROJECT THREE - EMPHASIS

PROJECT THREE - EMPHASIS PROJECT THREE - EMPHASIS INSTRUCTIONS Before you begin this assignment: 1. Read Design Basics, on the two topics of Emphasis and Color. Study the Introduction to Emphasis, the PowerPoint presentation,

More information

Lesson 6 Adding Graphics

Lesson 6 Adding Graphics Lesson 6 Adding Graphics Inserting Graphics Images Graphics files (pictures, drawings, and other images) can be inserted into documents, or into frames within documents. They can either be embedded or

More information

Making Backgrounds With Paint Shop Pro

Making Backgrounds With Paint Shop Pro Making Backgrounds With Paint Shop Pro A good Web site deserves a good background. Whether you decide on a single color, a faded repeated logo, a textured tile, or a border, the background of your Web

More information

AP CS Unit 12: Drawing and Mouse Events

AP CS Unit 12: Drawing and Mouse Events AP CS Unit 12: Drawing and Mouse Events A JPanel object can be used as a container for other objects. It can also be used as an object that we can draw on. The first example demonstrates how to do that.

More information

CS Multimedia and Communications REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB! Lab 02: Introduction to Photoshop Part 1

CS Multimedia and Communications REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB! Lab 02: Introduction to Photoshop Part 1 CS 1033 Multimedia and Communications REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB! Lab 02: Introduction to Photoshop Part 1 Upon completion of this lab, you should be able to: Open, create new, save

More information

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7 CPS109 Course Notes 7 Alexander Ferworn Unrelated Facts Worth Remembering The most successful people in any business are usually the most interesting. Don t confuse extensive documentation of a situation

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

TOPIC 5 INTRODUCTION TO PICTURES

TOPIC 5 INTRODUCTION TO PICTURES 1 TOPIC 5 INTRODUCTION TO PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared by B. Ericson.

More information

Using Visual Studio. Solutions and Projects

Using Visual Studio. Solutions and Projects Using Visual Studio Solutions and Projects A "solution" contains one or several related "projects". Formerly, the word workspace was used instead of solution, and it was a more descriptive word. For example,

More information

Form Properties Window

Form Properties Window C# Tutorial Create a Save The Eggs Item Drop Game in Visual Studio Start Visual Studio, Start a new project. Under the C# language, choose Windows Form Application. Name the project savetheeggs and click

More information

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to:

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to: CS1046 Lab 4 Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to: Define the terms: function, calling and user-defined function and predefined function

More information

Function Call Stack and Activation Records

Function Call Stack and Activation Records 71 Function Call Stack and Activation Records To understand how C performs function calls, we first need to consider a data structure (i.e., collection of related data items) known as a stack. Students

More information

CSci 1113, Fall 2015 Lab Exercise 11 (Week 13): Discrete Event Simulation. Warm-up. Stretch

CSci 1113, Fall 2015 Lab Exercise 11 (Week 13): Discrete Event Simulation. Warm-up. Stretch CSci 1113, Fall 2015 Lab Exercise 11 (Week 13): Discrete Event Simulation It's time to put all of your C++ knowledge to use to implement a substantial program. In this lab exercise you will construct a

More information

What can we do with Processing? Let s check. Natural Language and Dialogue Systems Lab Guest Image. Remember how colors work.

What can we do with Processing? Let s check. Natural Language and Dialogue Systems Lab Guest Image. Remember how colors work. MIDTERM REVIEW: THURSDAY I KNOW WHAT I WANT TO REVIEW. BUT ALSO I WOULD LIKE YOU TO TELL ME WHAT YOU MOST NEED TO GO OVER FOR MIDTERM. BY EMAIL AFTER TODAY S CLASS. What can we do with Processing? Let

More information

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them. We are working on Visual Studio 2010 but this project can be remade in any other version of visual studio. Start a new project in Visual Studio, make this a C# Windows Form Application and name it zombieshooter.

More information

XNA Tutorials Utah State University Association for Computing Machinery XNA Special Interest Group RB Whitaker 16 October 2007

XNA Tutorials Utah State University Association for Computing Machinery XNA Special Interest Group RB Whitaker 16 October 2007 XNA Tutorials Utah State University Association for Computing Machinery XNA Special Interest Group RB Whitaker 16 October 2007 Index Buffers Tutorial 9 Overview Our next task is to learn how to make our

More information

This document should only be used with the Apple Macintosh version of Splosh.

This document should only be used with the Apple Macintosh version of Splosh. Splosh 1 Introduction Splosh is an easy to use art package that runs under both Microsoft Windows and the Macintosh Mac OS Classic or Mac OS X operating systems. It should however be noted that the Apple

More information

TOPIC 5 INTRODUCTION TO PICTURES

TOPIC 5 INTRODUCTION TO PICTURES 1 TOPIC 5 INTRODUCTION TO PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared by B. Ericson.

More information

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW STAROFFICE 8 DRAW Graphics They say a picture is worth a thousand words. Pictures are often used along with our words for good reason. They help communicate our thoughts. They give extra information that

More information

CS 201 Advanced Object-Oriented Programming Lab 10 - Recursion Due: April 21/22, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 10 - Recursion Due: April 21/22, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 10 - Recursion Due: April 21/22, 11:30 PM Introduction to the Assignment In this assignment, you will get practice with recursion. There are three parts

More information

Hacettepe University Department Of Computer Engineering Bil203 Programming Laboratory Experiment 2

Hacettepe University Department Of Computer Engineering Bil203 Programming Laboratory Experiment 2 Hacettepe University Department Of Computer Engineering Bil203 Programming Laboratory Experiment 2 Subject : Traffic simulation via lists, queues and GDI+ Submission Date : 17.3.2015 Due Date : 31.3.2015

More information

Connecting Arduino to Processing

Connecting Arduino to Processing Connecting Arduino to Processing Introduction to Processing So, you ve blinked some LEDs with Arduino, and maybe you ve even drawn some pretty pictures with Processing - what s next? At this point you

More information

Part 7 More fill styles and an effect

Part 7 More fill styles and an effect Part 7 More fill styles and an effect Introduction To break the uniformity of the grass fill style, this part will continue creating fill styles and adding sheets show how to copy fill styles show how

More information

CpSc 101, Fall 2015 Lab7: Image File Creation

CpSc 101, Fall 2015 Lab7: Image File Creation CpSc 101, Fall 2015 Lab7: Image File Creation Goals Construct a C language program that will produce images of the flags of Poland, Netherland, and Italy. Image files Images (e.g. digital photos) consist

More information

Street Artist Teacher support materials Hour of Code 2017

Street Artist Teacher support materials Hour of Code 2017 Street Artist Street Artist Teacher support materials Hour of Code 07 Kano Hour of Code Street Artist Kano Hour of Code Challenge : Warmup What the ll make A random circle drawer that fills the screen

More information

Building Java Programs

Building Java Programs Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2 Objects (briefly) object: An entity that contains data and behavior. data: variables inside the object behavior: methods inside

More information

HAPPY HOLIDAYS PHOTO BORDER

HAPPY HOLIDAYS PHOTO BORDER HAPPY HOLIDAYS PHOTO BORDER In this Photoshop tutorial, we ll learn how to create a simple and fun Happy Holidays winter photo border! Photoshop ships with some great snowflake shapes that we can use in

More information

Graphics: Legacy Library

Graphics: Legacy Library Graphics: Legacy Library Version 5.1 February 14, 2011 (require graphics/graphics) The viewport graphics library is a relatively simple toolbox of graphics commands. The library is not very powerful; it

More information

Old 257 Exam #2s for Practice

Old 257 Exam #2s for Practice Old Exam #2s 257/757 Exploring Programming with Graphics Page 1 Old 257 Exam #2s for Practice Exams will be taken on Thursday March 27 in the cluster. You will have the entire class time to do the exam.

More information

Note that each button has a label, specified by the Text property of the button. The Text property of the group box is also visible as its title.

Note that each button has a label, specified by the Text property of the button. The Text property of the group box is also visible as its title. Radio Buttons and List Boxes The plan for this demo is to have a group of two radio buttons and a list box. Which radio button is selected will determine what is displayed in the list box. It will either

More information

CISC 1600, Lab 2.1: Processing

CISC 1600, Lab 2.1: Processing CISC 1600, Lab 2.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using Sketchpad, a site for building processing sketches online using processing.js. 1.1. Go to http://cisc1600.sketchpad.cc

More information

Visual Applications Graphics Lecture Nine. Graphics

Visual Applications Graphics Lecture Nine. Graphics Graphics You can use graphics to enhance the user interface of your applications, generate graphical charts and reports, and edit or create images. The.NET Framework includes tools that allow you to draw

More information

9 Using Appearance Attributes, Styles, and Effects

9 Using Appearance Attributes, Styles, and Effects 9 Using Appearance Attributes, Styles, and Effects You can alter the look of an object without changing its structure using appearance attributes fills, strokes, effects, transparency, blending modes,

More information

Full file at https://fratstock.eu Programming in Visual Basic 2010

Full file at https://fratstock.eu Programming in Visual Basic 2010 OBJECTIVES: Chapter 2 User Interface Design Upon completion of this chapter, your students will be able to 1. Use text boxes, masked text boxes, rich text boxes, group boxes, check boxes, radio buttons,

More information

What is the Deal with Color?

What is the Deal with Color? What is the Deal with Color? What is the Deal with Color? Beginning from the beginning Our First Moves Diffuse Object Colors Specular Lighting Transparency Paint on Image Those sliders and things Diffuse

More information

Load your files from the end of Lab A, since these will be your starting point.

Load your files from the end of Lab A, since these will be your starting point. Coursework Lab B It is extremely important that you finish lab A first, otherwise this lab session will probably not make sense to you. Lab B gives you a lot of the background and basics. The aim of the

More information

PSD to Mobile UI Tutorial

PSD to Mobile UI Tutorial PSD to Mobile UI Tutorial Contents Planning for design... 4 Decide the support devices for the application... 4 Target Device for design... 4 Import Asset package... 5 Basic Setting... 5 Preparation for

More information

Lab 3: Work with data (IV)

Lab 3: Work with data (IV) CS2370.03 Java Programming Spring 2005 Dr. Zhizhang Shen Background Lab 3: Work with data (IV) In this lab, we will go through a series of exercises to learn some basics of working with data, including

More information

Class #1. introduction, functions, variables, conditionals

Class #1. introduction, functions, variables, conditionals Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

HO-1: INTRODUCTION TO FIREWORKS

HO-1: INTRODUCTION TO FIREWORKS HO-1: INTRODUCTION TO FIREWORKS The Fireworks Work Environment Adobe Fireworks CS4 is a hybrid vector and bitmap tool that provides an efficient design environment for rapidly prototyping websites and

More information

PixelSurface a dynamic world of pixels for Unity

PixelSurface a dynamic world of pixels for Unity PixelSurface a dynamic world of pixels for Unity Oct 19, 2015 Joe Strout joe@luminaryapps.com Overview PixelSurface is a small class library for Unity that lets you manipulate 2D graphics on the level

More information

PLT Miscellaneous Libraries: Reference Manual

PLT Miscellaneous Libraries: Reference Manual PLT Miscellaneous Libraries: Reference Manual PLT (scheme@plt-scheme.org) Version 200 June 2002 Copyright notice Copyright c 1996-2002 PLT Permission to make digital/hard copies and/or distribute this

More information

Graffiti Wallpaper Photoshop Tutorial

Graffiti Wallpaper Photoshop Tutorial Graffiti Wallpaper Photoshop Tutorial Adapted from http://photoshoptutorials.ws/photoshop-tutorials/drawing/create-your-own-graffiti-wallpaper-inphotoshop.html Step 1 - Create a New Document Choose File

More information

Dice in Google SketchUp

Dice in Google SketchUp A die (the singular of dice) looks so simple. But if you want the holes placed exactly and consistently, you need to create some extra geometry to use as guides. Plus, using components for the holes is

More information