PictureBox, Timer, Resources. Resources An easy and effective way to add pictures (photos, graphics) to your programs Using Resources guarantees that.

Slides:



Advertisements
Similar presentations
Chapter 9 Color, Sound and Graphics
Advertisements

COMPUTER PROGRAMMING I Objective 8.03 Apply Animation and Graphic Methods in a Windows Form (4%)
Making a cartoon or slideshow. Aside VB comments An apostrophe starts a comment to end of line Some of the following slides have code with comments in.
© by Pearson Education, Inc. All Rights Reserved. continued …
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are.
Flowchart Start Input weight and height
Graphics Procedure (IDrawable) 1. Basic Procedure For Drawing ThingsToDraw Create Objects From Classes Add Them to PictureBox Use the Paint Event to draw.
Mouse event handling Mouse events( delegates EventHandler, event arguments EventArgs) MouseEnter: raised if the mouse cursor enters the area of the control.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
110-C1 Chapter 2 of the text: _ text boxes, group boxes, check boxes, radio buttons, picture boxes _ defining access keys tab sequence setting the focus.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
IE 411/511: Visual Programming for Industrial Applications
COMPUTER PROGRAMMING I Objective 8.03 Apply Animation and Graphic Methods in a Windows Form (4%)
GRAPHICAL MEDIA 1. ScannerScanner Graphics Sources 2.
EzWindows API A Graphical Application Programmer Interface JPC and JWD © 2002 McGraw-Hill, Inc.
BIM211 – Visual Programming Objects, Collections, and Events 1.
File Name Extensions Computer Applications 7th grade.
Chapter 9 - VB.Net by Schneider1 Chapter 9 – Additional Controls and Objects 9.1 List Boxes, Combo Boxes, and the File-Opening Control The List Box Control.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Chapter 6 Sub Procedures
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
BIL528 – Bilgisayar Programlama II Introduction 1.
Some graphics. Projects included A slideshow a dark moon moving phases of the moon billiards Your own icons and bitmaps Pie chart.
The PictureBox Control Prefix Prefix – pic Image Property PictureBox Image Property – Changes the image or file that appears inside of the PictureBox SizeMode.
Visual Basic.NET BASICS Lesson 3 Events and Code.
Cropping and Resizing Web Design Section 5-6 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
Laboratory Exercise # 9 – Inserting Graphics to Documents Office Productivity Tools 1 Laboratory Exercise # 9 Inserting Graphics to Documents Objectives:
BIM211 – Visual Programming Interacting with Users Graphics 1.
Introduction to Graphics. Terms n Computer Aided Design (CAD) –using computer graphics to draft a model, can be tested on screen n Computer Aided Manufacturing.
COMPUTER PROGRAMMING I SUMMER 2011 Objective 8.02 Apply Procedures to Create Picture Boxes using Images. (5%)
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6B Methods (Tutorial)
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Microsoft Visual Basic 2005 BASICS Lesson 3 Events and Code.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al- ajmi Chapter 3 Some Visual Basic Controls and Events Visual Basic. NET.
Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls.
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.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
1 Windows Forms II Chapter RadioButton / GroupBox Controls Used to solicit a multiple choice input. Radio buttons work as a group. Selecting one.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
PaintPictureBoxDemo Refers to the PaintPictureBoxDemo Visual Basic Program Included With The Lecture.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
Graphical User Interface Concepts - Part 1 Session 08 Mata kuliah: M0874 – Programming II Tahun: 2010.
Chapter 1: An Introduction to Visual Basic .NET
PictureBox, MessageBox, Multiple Forms, Splash Screens and Timers
Sprites (Images) and Sounds
Exploring Computer Science - Lesson 3-4
Exploring Computer Science - Lesson 3-4
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming UTPA – Fall 2012 This set of slides is revised from lecture.
3.01 Apply Controls Associated With Visual Studio Form
Objective 8.02 Apply Procedures to Create Picture Boxes using Images.
3.01 Apply Controls Associated With Visual Studio Form
Cropping and Resizing Web Design Section 5-6
Exploring Computer Science - Lesson 3-4
Creating Power Point Presentations
Chapter 6 Sub Procedures
Lesson 04 Control Structures I : Decision Making
MDI Picture Viewer Application
How to Customize Your Teens in the Driver Seat Poster
Simple Windows Applications
How to Customize Your Teens in the Driver Seat Poster
How to Customize Your Teens in the Driver Seat Poster
Working with Symbols and Interactivity
5.5 Adding Photo Gallery Module
Editing images using Microsoft Photo Editor and Paint
News Article Thumbnails TEMPLATE
Presentation transcript:

PictureBox, Timer, Resources

Resources An easy and effective way to add pictures (photos, graphics) to your programs Using Resources guarantees that your pictures will stay with your application—they are embedded in the exe file. Resources can be used in PictureBoxes, or as the BackgroundImage for forms and other controls

Adding a Picture Resource – Prepare the picture file—reduce the file size if possible – Go to your project’s properties – Go to resources – Select Add Resource  Add Existing File – Browse Windows for the picture that you want to add – Give the resource a simple, appropriate name— this name will show up in your code

Referencing a Resource – A picture resource has a data type of Image – To use a resource in code, simply type My.Resources.[resourcename] wherever an Image variable can be used. – For example, the constructor for my Window class takes an Image parameter, so I can pass it my “stream” picture like this: New Window(New Point(3, 3), 1, My.Resources.stream) – For the Image or BackgroundImage of any control that has these properties, all of the picture resources in your project will appear when you click the “…” box in the properties window.

Drawing a Picture on a Graphics Object DrawImage has many overloads; Pick the overload that best meets your needs.

PictureBox Control You know from assignment 4 that PictureBoxes can be drawn on, using a Graphics object. PictureBox controls are also used to display picture files directly: – Bitmap (*.bmp) – JPEG (*.jpg) – GIF (*.gif)

PictureBox Properties The Image property tells the PictureBox what image to display. You can set the Image property at design time using the properties window—simply select the resource or file that you want to use. To set the Image property in code, use the Load procedure: PictureBox1.Load(“C:\MyPicture.jpg”)

SizeMode The SizeMode property determines how the picture fits into the PictureBox. It can take one of five values: – AutoSize: The PictureBox changes its size to match the picture. – Normal: Displays the picture at normal size in the upper- left corner of the PictureBox. If the picture is too big, it is clipped; if it is too small, white space appears around it. – CenterImage: Just like normal, except the picture is centered in the PictureBox. – Zoom: Provides the best fit for the picture in the PictureBox. The image will be enlarged or reduced to fit, but will not be distorted. – StretchImage: Forces the image to fit the PictureBox exactly, distorting it if necessary (changing its aspect ratio).

Timers Timers are event generators. At regular time intervals, a Tick event is generated. You can write code to handle the Tick event just like any other event.

Timer Properties Enabled: When True, the Timer Ticks. When False, it does nothing (no Tick events are generated). To turn a Timer off, set Enabled to False. Interval: The time in milliseconds between ticks. If you want a Timer to tick five times a second, set Interval to 200.