SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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-slidesSami Mut
 
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
 
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-slidesSami Mut
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
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-slidesSami 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-slidesSami Mut
 
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-slidesSami Mut
 
Visual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICVisual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICMauricio 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 2008jessandy
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Bhushan Mulmule
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
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-slidesSami Mut
 

Mais procurados (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
 

Semelhante a Intake 37 9

Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.pptLalRatan
 
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.pptxAOmaAli
 
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 programmingsanaiftikhar23
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxEliasPetros
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptxkulmiyealiabdille
 
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 classmnewg218
 
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 88Mahmoud Samir Fayed
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic conceptsmelody77776
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03PCC
 
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
 

Semelhante a 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
 

Mais de Mahmoud Ouf

Mais de 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
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

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