Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010.

Similar presentations


Presentation on theme: "Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010."— Presentation transcript:

1

2 Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010

3 Bina Nusantara University 3 Outline Materi Introduction Graphics Contexts and Graphics Objects Drawing in C# Introduction to Multimedia

4 Bina Nusantara University 4 Introduction C# supports graphics that enable programmers to enhance their Windows applications visually. Graphics, video, sound, and printing are the hallmarks of a traditional rich client on the Microsoft Windows operating system.

5 5 Graphics Contexts and Graphics Objects A C# graphics context represents a drawing surface that enables drawing on the screen. A Graphics object manages a graphics context by controlling how information is drawn. Graphics object contain methods for drawing, font manipulation, color manipulation and other graphics- related actions. Every windows application that derives from class System.Windows.Forms.Form inherits a virtual OnPaint event handler where most graphics operations are performed.

6 Bina Nusantara University 6 Graphics Contexts and Graphics Objects The argument to the OnPaint method include a PaintEventArgs object from which we can obtain a Graphics object for the control. The OnPaint mehtod triggers the Control’s Paint event. To override the inherited OnPaint mehtod, use the following method definition: protected override void OnPaint ( PaintEventArgs e ) Extract the incoming Graphics object from the PaintEventArgs argument: Grapics graphicsObject = e.Graphics;

7 Bina Nusantara University 7 Graphics Contexts and Graphics Objects

8 Bina Nusantara University 8 Creating a Pen Example, create red pen that is 5 pixels wide as follows:

9 Bina Nusantara University 9 Creating a Pen Once a Pen object has been created other properties may be changed. Example, the DashStyle property can be modified to change the style of line (i.e Dash, DashDot, DashDotDot, Dot, Solid or Custom). Properties such as the color and width may similarly be changed after a Pen has been created:

10 Bina Nusantara University 10 Drawing Lines Lines are drawn in C# using the DrawLine() method of the Graphics Object.

11 Bina Nusantara University 11 Drawing Squares and Rectangles

12 Bina Nusantara University 12 Drawing Ellipses and Circles

13 Bina Nusantara University 13 Drawing Text

14 Bina Nusantara University 14 Introduction to Multimedia C# offers many convenient ways to include images and animations in programs. Multimedia programming is an entertaining and innovative field, but one that presents many challenges. Multimedia applications demand extraordinary computing power.

15 Bina Nusantara University 15 Multimedia Using Visual Studio.NET and C#, programmers can create applications that use components such as Windows Media Player and Microsoft Agent. The Windows Media Player allows programmers to create applications that can play multimedia files. Microsoft Agent is a technology that allows programmers to include interactive animated characters in their applications.

16 Bina Nusantara University 16 References http://www.techotopia.com/index.php/Drawing_Gra phics_in_C_Sharphttp://www.techotopia.com/index.php/Drawing_Gra phics_in_C_Sharp http://www.vcskicks.com/csharp_animated_gif.php


Download ppt "Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010."

Similar presentations


Ads by Google