0% found this document useful (1 vote)
308 views22 pages

c1 - C# Windows Forms Application

This document provides an overview of tutorials for creating Windows Forms applications in C#. It includes tutorials for building a picture viewer application, a timed math quiz, and a matching game. The tutorials demonstrate how to use controls, work with events, perform operations, and manage application state and flow.

Uploaded by

Dao Nguyen Minh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (1 vote)
308 views22 pages

c1 - C# Windows Forms Application

This document provides an overview of tutorials for creating Windows Forms applications in C#. It includes tutorials for building a picture viewer application, a timed math quiz, and a matching game. The tutorials demonstrate how to use controls, work with events, perform operations, and manage application state and flow.

Uploaded by

Dao Nguyen Minh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 22

C# Windows Forms

Application
Windows Forms Basics 2

LECTURER: NGUYEN MINH DAO


OVERVIEW 3

 A windows form application is any application,


which is designed to run on a computer. It will
not run on web browser because then it becomes
a web application.
 This chapter will focus on how we can create
Windows-based applications. We will also learn
some basics on how to work with the various
elements of Windows applications.
LECTURER: NGUYEN MINH DAO
Simple Example: Login form 4

A Windows forms
application is one that
runs on the desktop
computer.
A Windows forms
application will normally
have a collection of
controls such as labels,
textboxes, list boxes,
etc.

LECTURER: NGUYEN MINH DAO


Simple Example: Login form 5

• So an example of the controls available in the above


application
• We have 2 textboxes, and the labels are used to tell the user that
one textbox is for entering the user name and the other for the
password. The 2 textboxes are used to hold the username and
password which will be entered by the user.
• Finally, we have the button control. The button control will normally
have some code attached to perform a certain set of actions. So for
example in the above case, we could have the button perform an
action of validating the user name and password which is entered by
the user.
LECTURER: NGUYEN MINH DAO
Simple Example: Login form 6

LECTURER: NGUYEN MINH DAO


Simple Example: Login form 7

LECTURER: NGUYEN MINH DAO


Tutorial 1: Create a Picture Viewer
(https://msdn.microsoft.com/en-us/library/dd492135.aspx) 8

LECTURER: NGUYEN MINH DAO


Tutorial 1: Create a Picture Viewer
(https://msdn.microsoft.com/en-us/library/dd492135.aspx) 9

 In this tutorial, you build a program that loads a picture


from a file and displays it in a window. You learn how to:
• Create a new project.
• Test (debug) an application.
• Add basic controls like check boxes and buttons to a form.
• Position controls on a form using layouts.
• Add Open File and Color dialog boxes to a form.
• Write code using IntelliSense and code snippets.
• Write event handler methods.
LECTURER: NGUYEN MINH DAO
Tutorial 1: Create a Picture Viewer
(https://msdn.microsoft.com/en-us/library/dd492135.aspx) 10

LECTURER: NGUYEN MINH DAO


Tutorial 1: Create a Picture Viewer
(https://msdn.microsoft.com/en-us/library/dd492135.aspx) 11

LECTURER: NGUYEN MINH DAO


Tutorial 1: Create a Picture Viewer
(https://msdn.microsoft.com/en-us/library/dd492135.aspx) 12

LECTURER: NGUYEN MINH DAO


Tutorial 2: Create a Timed Math Quiz
(https://msdn.microsoft.com/en-us/library/dd492172.aspx) 13

LECTURER: NGUYEN MINH DAO


Tutorial 2: Create a Timed Math Quiz
(https://msdn.microsoft.com/en-us/library/dd492172.aspx) 14

• In this tutorial, you build a quiz in which the quiz taker


must answer four random arithmetic problems within a
specified time. You learn how to:
• Generate random numbers by using the Random class.
• Trigger events to occur at a specific time by using a Timer
control.
• Control program flow by using if else statements.
• Perform basic arithmetic operations in code.

LECTURER: NGUYEN MINH DAO


Tutorial 2: Create a Timed Math Quiz
(https://msdn.microsoft.com/en-us/library/dd492172.aspx) 15

LECTURER: NGUYEN MINH DAO


Tutorial 2: Create a Timed Math Quiz
(https://msdn.microsoft.com/en-us/library/dd492172.aspx) 16

LECTURER: NGUYEN MINH DAO


Tutorial 2: Create a Timed Math Quiz
(https://msdn.microsoft.com/en-us/library/dd492172.aspx) 17

LECTURER: NGUYEN MINH DAO


Tutorial 3: Create a Matching Game
(https://msdn.microsoft.com/en-us/library/dd553235.aspx) 18

LECTURER: NGUYEN MINH DAO


Tutorial 3: Create a Matching Game
(https://msdn.microsoft.com/en-us/library/dd553235.aspx) 19

• In this tutorial, you build a matching game, where the player


must match pairs of hidden icons. You learn how to:
• Store objects, such as icons, in a List object.
• Use a foreach loop in Visual C# or a For Each loop in Visual Basic to
iterate through items in a list.
• Keep track of a form's state by using reference variables.
• Build an event handler to respond to events that you can use with
multiple objects.
• Make a timer that counts down and then fires an event exactly once
after being started.
LECTURER: NGUYEN MINH DAO
Tutorial 3: Create a Matching Game
(https://msdn.microsoft.com/en-us/library/dd553235.aspx) 20

LECTURER: NGUYEN MINH DAO


Tutorial 3: Create a Matching Game
(https://msdn.microsoft.com/en-us/library/dd553235.aspx) 21

LECTURER: NGUYEN MINH DAO


Tutorial 3: Create a Matching Game
(https://msdn.microsoft.com/en-us/library/dd553235.aspx) 22

LECTURER: NGUYEN MINH DAO

You might also like