SlideShare a Scribd company logo
Visual C# .Net using
framework 4.5
Eng. Mahmoud Ouf
Lecture 09
mmouf@2017
Multiple-Document-Interface (MDI) Windows
Till now, we have built only single-document-interface (SDI) applications.
Such programs (including Notepad or Paint) support only one open window
or document at a time.
To edit multiple documents, the user must create additional instances of the
SDI application.
Multiple document interface (MDI) programs (such as Adobe Photoshop)
enable users to edit multiple documents at once. MDI programs also tend to
be more complex.
The application window of an MDI program is called the parent window,
and each window inside the application is referred to as a child window.
Although an MDI application can have many child windows, each has only
one parent window.
mmouf@2017
Multiple-Document-Interface (MDI) Windows
Note:
Only one child window can be active at a time.
Child windows cannot be parents themselves and cannot be moved outside
their parent.
A child window’s functionality can be different from the functionality of
other child windows of the parent.
For example, one child window might edit images, another might edit text
and a third might display network traffic graphically, but all could belong to
the same MDI parent.
mmouf@2017
Multiple-Document-Interface (MDI) Windows
To create an MDI form:
1) create a new Form and set its IsMDIContainer property to True
2) create a child form class to be added to the form. (To do this, right-
click the project in the Solution Explorer, select Add Windows Form... and
name the file.
3) To add the child form to the parent, we must create a new child form
object; set its Mdi-Parent property to the parent form, and call method
Show.
Note:
The code to create a child (step 3), usually lies inside an event handler,
which creates a new window in response to a user action.
mmouf@2017
Multiple-Document-Interface (MDI) Windows
To create an MDI form:
1) create a new Form and set its IsMDIContainer property to True
2) create a child form class to be added to the form. (To do this, right-
click the project in the Solution Explorer, select Add Windows Form... and
name the file.
3) To add the child form to the parent, we must create a new child form
object; set its Mdi-Parent property to the parent form, and call method
Show.
Note:
The code to create a child (step 3), usually lies inside an event handler,
which creates a new window in response to a user action.
mmouf@2017
Multiple-Document-Interface (MDI) Windows
Common MDI Child Properties
IsMdiChild Indicates whether the Form is an MDI child. If True, Form is an
MDI child (read-only property).
MdiParent Specifies the MDI parent Form of the child.
Common MDI Parent Properties
ActiveMdiChild Returns the Form that is the currently active MDI child
(returns null if no children are active).
IsMdiContainer Indicates whether a Form can be an MDI. If True, the Form
can be an MDI parent. Default is False.
MdiChildren Returns the MDI children as an array of Forms.
mmouf@2017
Multiple-Document-Interface (MDI) Windows
Common Method
LayoutMdi Determines the display of child forms on an MDI parent. Takes
as a parameter an MdiLayout enumeration with possible values
ArrangeIcons, Cascade, TileHorizontal and TileVertical.
mmouf@2017
Controls
Add Control to form Programmatically:
1. Define an object from the control
2. Create an object from the control
3. Set the object properties
4. Add the object to the form
Example: Add a button to a form:
1. Button btn;
2. btn = new Button();
3. btn.Text = “Press the Button”;
btn.Location = new Point(80, 80);
4. this.Controls.Add(this.btn);
mmouf@2017
Controls
Add Control to form Using the Windows Forms Designer:
1. From the ToolBox, Drag the Control that you want to add to the form
and place it in the Location you need it.
2. The windows Form designer will generate the code.
3. The windows Form designer usually put the code that it generates in a
function named InitializeComponent(), and this is the function to be
called in the form constructor
Setting the control property:
From Design View:
Select the control, set the property from the property window
Programmatically:
Write the control_name.the property_name = value
mmouf@2017
Dialog Box
The DialogBox is a kind of form that is used to set some properties.
There is a lot of defined dialogBox “Common Dialog Box” such as “Open,
Save, …)
Also, the user can make his own DialogBox.
There are two types of DialogBox:
•Modal DialogBox :
it is the most common, it changes the mode of i/p from the main application
to the dialog box. The user can’t switch between DialogBox and the
application until he end explicitly the DialogBox (Ok/Cancel).
•Modeless DialogBox :
here the user can switch between the DialogBox and the Application.
mmouf@2017
Dialog Box
•Modal DialogBox :
it is the most common, it changes the mode of i/p from the main application
to the dialog box. The user can’t switch between DialogBox and the
application
Programmers often use Modal Dialog Box when program needs to obtain
information from a user beyond what can be easily managed in Menu.
To Create Modal DialogBox:
1. Create class for DialogBox (Has 2 buttons Ok/Cancel)
2. Create class for Application Create object from Dialog Class
3. Call ShowDialog (Invoke the Modal)
There is a property of the dialogbox form named DialogResult of type
DialogResult which is enumeration.
mmouf@2017
Dialog Box
•Modal DialogBox :
In either case select Ok/Cancel, the dialog box is closed “disappear from the
screen” and return to the point it is called from.
When closing, the ShowDialog() return the value of the DialogResult
property
Although the dialogbox has been terminated and no longer visible, the
dialogbox object is still valid. This means that we can access all member of
the dialogBox.
•Modeless DialogBox:
There is a property named owner, set its value to the Application name.
Before calling Show() method
Note: Don’t forget to set the value of the DialogResult of the DialogBox to
DialogBox.Ok / DialogBox.Cancel in the handel of Ok/Cancel buttons.
mmouf@2017
Common Dialog Box
C# contains a set of common dialog boxes, which are ready made dialog box
(Color, Open, Save, …).
All common dialog boxes are “Modal dialog box”, and are treated as any
modal dialog box.
The dealing with common dialog box, is like other dialog box except you are
not going to create the dialog box.
I.E.
In the event that will display the dialog box, you have to:
1) Create an object from the dialog box
2) Call the ShowDialog() method
3) Handle the value which return from ShowDialog(), even Ok or Cancel
mmouf@2017
Tab Control
The TabControl control creates tabbed windows. This allows the
programmer to design user interfaces that fit a large number of controls or a
large amount of data without using up valuable screen “real estate.”
TabControls contain TabPage objects which can contain controls.
1) add the TabPages to the TabControl.
2) add controls to the TabPage objects
Only one TabPage is displayed at a time. Programmers can add TabControls
visually by dragging and dropping them onto a form in design mode.
To add TabPages in the Visual Studio .NET designer, right-click the
TabControl, and select Add Tab.
Alternatively, click the TabPages collection in the Properties window, and
add tabs in the dialog that appears.
mmouf@2017
Tab Control
TabControl properties:
ImageList: Specifies images to be displayed on a tab
ItemSize: Specifies tab size.
MultiLine: Indicates whether multiple rows of tabs can be displayed
SelectedIndex: Indicates index of TabPage that is currently selected
SelectedTab: Indicates the TabPage that is currently selected
TabCount: Returns the number of tabs.
TabPages: Gets the collection of TabPages within our TabControl
mmouf@2017
User Defined Controls
The .NET Framework allows programmers to create custom controls that
inherit from a variety of classes.
These custom controls appear in the user’s Toolbox and can be added to
Forms, Panels or GroupBoxes in the same way that we add Buttons, Labels,
and other predefined controls.
The simplest way to create a custom control is to derive a class from an
existing Windows Forms control, such as a Label.
This is useful if the programmer wants to include functionality of an
existing control, rather than having to reimplement the existing control in
addition to including the desired new functionality.
For example, we can create a new type of label that behaves like a normal
Label but has a different appearance. We accomplish this by inheriting from
class Label and overriding method On-Paint.
mmouf@2017
User Defined Controls
To create a new control composed of existing controls, use class
UserControl.
Controls added to a custom control are called constituent controls.
For example, a programmer could create a UserControl composed of a
button, a label and a text box, each associated with some functionality
(such as that the button sets the label’s text to that contained in the text
box).
The UserControl acts as a container for the controls added to it.
Method OnPaint cannot be overridden in these custom controls—their
appearance can be modified only by handling each constituent control’s
Paint event.
mmouf@2017
User Defined Controls
A programmer can create a brand-new control by inheriting from class
Control.
This class does not define any specific behavior; that task is left to the
programmer.
Instead, class Control handles the items associated with all controls, such
as events and sizing handles.
Method OnPaint should contain a call to the base class’s OnPaint method,
which calls the Paint event handlers.
The programmer must then add code for custom graphics inside the
overridden OnPaint method.
This technique allows for the greatest flexibility
mmouf@2017

More Related Content

What's hot

C# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slidesC# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slides
Sami Mut
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
Ali Mattash
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
francopw
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
Ranjuma Shubhangi
 
C# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slidesC# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slides
Sami Mut
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
marwaeng
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinFormHock Leng PUAH
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
Sami Mut
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
Hock Leng PUAH
 
Session 1. Bai 1 ve winform
Session 1. Bai 1 ve winformSession 1. Bai 1 ve winform
Session 1. Bai 1 ve winformmrtom16071980
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
Sami Mut
 
Visual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICVisual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TIC
Mauricio Correa
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
Moutasm Tamimi
 
Class viii ch-7 visual basic 2008
Class  viii ch-7 visual basic 2008Class  viii ch-7 visual basic 2008
Class viii ch-7 visual basic 2008
jessandy
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
Bhushan Mulmule
 
06 win forms
06 win forms06 win forms
06 win forms
mrjw
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
Sami Mut
 

What's hot (20)

C# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slidesC# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slides
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
4.C#
4.C#4.C#
4.C#
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Active x control
Active x controlActive x control
Active x control
 
C# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slidesC# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slides
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
 
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
Session 1. Bai 1 ve winform
Session 1. Bai 1 ve winformSession 1. Bai 1 ve winform
Session 1. Bai 1 ve winform
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
 
Visual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICVisual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TIC
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
 
Class viii ch-7 visual basic 2008
Class  viii ch-7 visual basic 2008Class  viii ch-7 visual basic 2008
Class viii ch-7 visual basic 2008
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
 
06 win forms
06 win forms06 win forms
06 win forms
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
 

Similar to Intake 37 9

Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
Mahmoud Ouf
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
JOSEPHINEA6
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.ppt
LalRatan
 
LECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxLECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptx
AOmaAli
 
Visual programming is a type of programming
Visual programming is a type of programmingVisual programming is a type of programming
Visual programming is a type of programming
sanaiftikhar23
 
unit 4.docx
unit 4.docxunit 4.docx
unit 4.docx
Sadhana Sreekanth
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
EliasPetros
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptx
kulmiyealiabdille
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th class
mnewg218
 
The Ring programming language version 1.3 book - Part 54 of 88
The Ring programming language version 1.3 book - Part 54 of 88The Ring programming language version 1.3 book - Part 54 of 88
The Ring programming language version 1.3 book - Part 54 of 88
Mahmoud Samir Fayed
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
melody77776
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03PCC
 
Create New Android Activity
Create New Android ActivityCreate New Android Activity
Create New Android Activity
Transpose Solutions Inc
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI WidgetsAhsanul Karim
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
Gui builder
Gui builderGui builder
Gui builderlearnt
 

Similar to Intake 37 9 (20)

Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.ppt
 
LECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxLECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptx
 
Visual programming is a type of programming
Visual programming is a type of programmingVisual programming is a type of programming
Visual programming is a type of programming
 
unit 4.docx
unit 4.docxunit 4.docx
unit 4.docx
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptx
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th class
 
Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
The Ring programming language version 1.3 book - Part 54 of 88
The Ring programming language version 1.3 book - Part 54 of 88The Ring programming language version 1.3 book - Part 54 of 88
The Ring programming language version 1.3 book - Part 54 of 88
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
 
04 gui 05
04 gui 0504 gui 05
04 gui 05
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
 
Create New Android Activity
Create New Android ActivityCreate New Android Activity
Create New Android Activity
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Gui builder
Gui builderGui builder
Gui builder
 

More from Mahmoud Ouf

Relation between classes in arabic
Relation between classes in arabicRelation between classes in arabic
Relation between classes in arabic
Mahmoud Ouf
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
Mahmoud Ouf
 
Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4
Mahmoud Ouf
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
Mahmoud Ouf
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
Mahmoud Ouf
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
Mahmoud Ouf
 
Intake 38 11
Intake 38 11Intake 38 11
Intake 38 11
Mahmoud Ouf
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
Mahmoud Ouf
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
Mahmoud Ouf
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
Mahmoud Ouf
 
Intake 38 5 1
Intake 38 5 1Intake 38 5 1
Intake 38 5 1
Mahmoud Ouf
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
Mahmoud Ouf
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
Mahmoud Ouf
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
Mahmoud Ouf
 
Intake 38 2
Intake 38 2Intake 38 2
Intake 38 2
Mahmoud Ouf
 
Intake 38_1
Intake 38_1Intake 38_1
Intake 38_1
Mahmoud Ouf
 
Intake 37 DM
Intake 37 DMIntake 37 DM
Intake 37 DM
Mahmoud Ouf
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
Mahmoud Ouf
 
Intake 37 ef1
Intake 37 ef1Intake 37 ef1
Intake 37 ef1
Mahmoud Ouf
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
Mahmoud Ouf
 

More from Mahmoud Ouf (20)

Relation between classes in arabic
Relation between classes in arabicRelation between classes in arabic
Relation between classes in arabic
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
 
Intake 38 11
Intake 38 11Intake 38 11
Intake 38 11
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
 
Intake 38 5 1
Intake 38 5 1Intake 38 5 1
Intake 38 5 1
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Intake 38 2
Intake 38 2Intake 38 2
Intake 38 2
 
Intake 38_1
Intake 38_1Intake 38_1
Intake 38_1
 
Intake 37 DM
Intake 37 DMIntake 37 DM
Intake 37 DM
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
 
Intake 37 ef1
Intake 37 ef1Intake 37 ef1
Intake 37 ef1
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

Intake 37 9

  • 1. Visual C# .Net using framework 4.5 Eng. Mahmoud Ouf Lecture 09 mmouf@2017
  • 2. Multiple-Document-Interface (MDI) Windows Till now, we have built only single-document-interface (SDI) applications. Such programs (including Notepad or Paint) support only one open window or document at a time. To edit multiple documents, the user must create additional instances of the SDI application. Multiple document interface (MDI) programs (such as Adobe Photoshop) enable users to edit multiple documents at once. MDI programs also tend to be more complex. The application window of an MDI program is called the parent window, and each window inside the application is referred to as a child window. Although an MDI application can have many child windows, each has only one parent window. mmouf@2017
  • 3. Multiple-Document-Interface (MDI) Windows Note: Only one child window can be active at a time. Child windows cannot be parents themselves and cannot be moved outside their parent. A child window’s functionality can be different from the functionality of other child windows of the parent. For example, one child window might edit images, another might edit text and a third might display network traffic graphically, but all could belong to the same MDI parent. mmouf@2017
  • 4. Multiple-Document-Interface (MDI) Windows To create an MDI form: 1) create a new Form and set its IsMDIContainer property to True 2) create a child form class to be added to the form. (To do this, right- click the project in the Solution Explorer, select Add Windows Form... and name the file. 3) To add the child form to the parent, we must create a new child form object; set its Mdi-Parent property to the parent form, and call method Show. Note: The code to create a child (step 3), usually lies inside an event handler, which creates a new window in response to a user action. mmouf@2017
  • 5. Multiple-Document-Interface (MDI) Windows To create an MDI form: 1) create a new Form and set its IsMDIContainer property to True 2) create a child form class to be added to the form. (To do this, right- click the project in the Solution Explorer, select Add Windows Form... and name the file. 3) To add the child form to the parent, we must create a new child form object; set its Mdi-Parent property to the parent form, and call method Show. Note: The code to create a child (step 3), usually lies inside an event handler, which creates a new window in response to a user action. mmouf@2017
  • 6. Multiple-Document-Interface (MDI) Windows Common MDI Child Properties IsMdiChild Indicates whether the Form is an MDI child. If True, Form is an MDI child (read-only property). MdiParent Specifies the MDI parent Form of the child. Common MDI Parent Properties ActiveMdiChild Returns the Form that is the currently active MDI child (returns null if no children are active). IsMdiContainer Indicates whether a Form can be an MDI. If True, the Form can be an MDI parent. Default is False. MdiChildren Returns the MDI children as an array of Forms. mmouf@2017
  • 7. Multiple-Document-Interface (MDI) Windows Common Method LayoutMdi Determines the display of child forms on an MDI parent. Takes as a parameter an MdiLayout enumeration with possible values ArrangeIcons, Cascade, TileHorizontal and TileVertical. mmouf@2017
  • 8. Controls Add Control to form Programmatically: 1. Define an object from the control 2. Create an object from the control 3. Set the object properties 4. Add the object to the form Example: Add a button to a form: 1. Button btn; 2. btn = new Button(); 3. btn.Text = “Press the Button”; btn.Location = new Point(80, 80); 4. this.Controls.Add(this.btn); mmouf@2017
  • 9. Controls Add Control to form Using the Windows Forms Designer: 1. From the ToolBox, Drag the Control that you want to add to the form and place it in the Location you need it. 2. The windows Form designer will generate the code. 3. The windows Form designer usually put the code that it generates in a function named InitializeComponent(), and this is the function to be called in the form constructor Setting the control property: From Design View: Select the control, set the property from the property window Programmatically: Write the control_name.the property_name = value mmouf@2017
  • 10. Dialog Box The DialogBox is a kind of form that is used to set some properties. There is a lot of defined dialogBox “Common Dialog Box” such as “Open, Save, …) Also, the user can make his own DialogBox. There are two types of DialogBox: •Modal DialogBox : it is the most common, it changes the mode of i/p from the main application to the dialog box. The user can’t switch between DialogBox and the application until he end explicitly the DialogBox (Ok/Cancel). •Modeless DialogBox : here the user can switch between the DialogBox and the Application. mmouf@2017
  • 11. Dialog Box •Modal DialogBox : it is the most common, it changes the mode of i/p from the main application to the dialog box. The user can’t switch between DialogBox and the application Programmers often use Modal Dialog Box when program needs to obtain information from a user beyond what can be easily managed in Menu. To Create Modal DialogBox: 1. Create class for DialogBox (Has 2 buttons Ok/Cancel) 2. Create class for Application Create object from Dialog Class 3. Call ShowDialog (Invoke the Modal) There is a property of the dialogbox form named DialogResult of type DialogResult which is enumeration. mmouf@2017
  • 12. Dialog Box •Modal DialogBox : In either case select Ok/Cancel, the dialog box is closed “disappear from the screen” and return to the point it is called from. When closing, the ShowDialog() return the value of the DialogResult property Although the dialogbox has been terminated and no longer visible, the dialogbox object is still valid. This means that we can access all member of the dialogBox. •Modeless DialogBox: There is a property named owner, set its value to the Application name. Before calling Show() method Note: Don’t forget to set the value of the DialogResult of the DialogBox to DialogBox.Ok / DialogBox.Cancel in the handel of Ok/Cancel buttons. mmouf@2017
  • 13. Common Dialog Box C# contains a set of common dialog boxes, which are ready made dialog box (Color, Open, Save, …). All common dialog boxes are “Modal dialog box”, and are treated as any modal dialog box. The dealing with common dialog box, is like other dialog box except you are not going to create the dialog box. I.E. In the event that will display the dialog box, you have to: 1) Create an object from the dialog box 2) Call the ShowDialog() method 3) Handle the value which return from ShowDialog(), even Ok or Cancel mmouf@2017
  • 14. Tab Control The TabControl control creates tabbed windows. This allows the programmer to design user interfaces that fit a large number of controls or a large amount of data without using up valuable screen “real estate.” TabControls contain TabPage objects which can contain controls. 1) add the TabPages to the TabControl. 2) add controls to the TabPage objects Only one TabPage is displayed at a time. Programmers can add TabControls visually by dragging and dropping them onto a form in design mode. To add TabPages in the Visual Studio .NET designer, right-click the TabControl, and select Add Tab. Alternatively, click the TabPages collection in the Properties window, and add tabs in the dialog that appears. mmouf@2017
  • 15. Tab Control TabControl properties: ImageList: Specifies images to be displayed on a tab ItemSize: Specifies tab size. MultiLine: Indicates whether multiple rows of tabs can be displayed SelectedIndex: Indicates index of TabPage that is currently selected SelectedTab: Indicates the TabPage that is currently selected TabCount: Returns the number of tabs. TabPages: Gets the collection of TabPages within our TabControl mmouf@2017
  • 16. User Defined Controls The .NET Framework allows programmers to create custom controls that inherit from a variety of classes. These custom controls appear in the user’s Toolbox and can be added to Forms, Panels or GroupBoxes in the same way that we add Buttons, Labels, and other predefined controls. The simplest way to create a custom control is to derive a class from an existing Windows Forms control, such as a Label. This is useful if the programmer wants to include functionality of an existing control, rather than having to reimplement the existing control in addition to including the desired new functionality. For example, we can create a new type of label that behaves like a normal Label but has a different appearance. We accomplish this by inheriting from class Label and overriding method On-Paint. mmouf@2017
  • 17. User Defined Controls To create a new control composed of existing controls, use class UserControl. Controls added to a custom control are called constituent controls. For example, a programmer could create a UserControl composed of a button, a label and a text box, each associated with some functionality (such as that the button sets the label’s text to that contained in the text box). The UserControl acts as a container for the controls added to it. Method OnPaint cannot be overridden in these custom controls—their appearance can be modified only by handling each constituent control’s Paint event. mmouf@2017
  • 18. User Defined Controls A programmer can create a brand-new control by inheriting from class Control. This class does not define any specific behavior; that task is left to the programmer. Instead, class Control handles the items associated with all controls, such as events and sizing handles. Method OnPaint should contain a call to the base class’s OnPaint method, which calls the Paint event handlers. The programmer must then add code for custom graphics inside the overridden OnPaint method. This technique allows for the greatest flexibility mmouf@2017