0% found this document useful (0 votes)
15 views23 pages

Lecture 12 P3 - STD - Events and Event Parameters in C Sharp

The document discusses creating a simple GUI application in C# using Visual Studio. It covers designing forms in C#, understanding events and event parameters in C#, and hiding and showing forms. It provides instructions on creating a Windows form project, adding controls to forms, and handling events for controls like buttons and displaying messages.

Uploaded by

kyungmun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views23 pages

Lecture 12 P3 - STD - Events and Event Parameters in C Sharp

The document discusses creating a simple GUI application in C# using Visual Studio. It covers designing forms in C#, understanding events and event parameters in C#, and hiding and showing forms. It provides instructions on creating a Windows form project, adding controls to forms, and handling events for controls like buttons and displaying messages.

Uploaded by

kyungmun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

- Fall 2021 -

Asst Prof. Essaid Meryam


Department of Robotics Engineering
OUTLINE: SIMPLE C SHARP GUI APPLICATION

 Designing Forms in C Sharp and Visual Studio


 Understanding C# GUI Events
 Events and Event Parameters in C Sharp & Hiding and
Showing Forms in C Sharp
CREATE A C# WINDOWS APPLICATIONS
• To create your first Windows form project, click the File menu.
Select New Project from the menu. When you do, you'll see the New
Project dialogue box again.

1
CREATE A C# WINDOWS APPLICATIONS
• Select Windows Forms Application or Windows Forms App. Keep the Name on the
default of WindowsFormsApp1 and then click Next.

2
CREATE A C# WINDOWS APPLICATIONS
4

• Windows Application
project is created. 
• Notice the Toolbox,
though, on the left hand
side. We'll be adding
controls from the Toolbox
to that blank Form1 you
can see in the image above.

5
ADDING CONTROLS TO A FORM
ADDING CONTROLS TO A FORM
EVENTS AND EVENT
PARAMETERS IN C SHARP
& HIDING AND SHOWING
FORMS IN C SHARP
C# EVENT HANDLING FOR CONTROLS

• When working with windows form, you can add events to controls.
• An event is something that happens when an action is performed.
• Probably the most common action is the clicking of a button on a form.
• In C# Windows Forms, you can add code which can be used to perform certain
actions when a button is pressed on the form.
C# EVENT HANDLING FOR CONTROLS
• What we want to do now is to display a message box whenever the button is
clicked.
• To see the code for the button, double click the button you added to the Form, or
right click on the button then select view code.
C# EVENT
HANDLING FOR
• TheCONTROLS
coding window will open, and your
cursor will be flashing inside of the button
code. It will look like this:
C# EVENT HANDLING FOR CONTROLS
 C# Messagebox
C# EVENT HANDLING FOR CONTROLS
 C# Message Box
 Get user input – Selected Item
 Tree and Picture Box Control

• There are 2 further controls, one is the ‘Tree Control’ and the other is the ‘Image
control’.
 Tree Control
• The tree control is used to list down items in a tree like fashion. Probably the best
example is when we see the Windows Explorer itself. The folder structure in
Windows Explorer is like a tree-like structure.
C# EVENT HANDLING FOR CONTROLS
 Implement a Tree Control
C# EVENT HANDLING FOR
CONTROLS
 Picture Box Control
C# WINDOWS APPLICATIONS
QUESTIONS?
Let’s take a break!
C# EVENT HANDLING FOR CONTROLS
Exercise
QUESTIONS?

You might also like