0% found this document useful (0 votes)
13 views27 pages

Vcsharphtp6 02

Uploaded by

tala.rateb.learn
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)
13 views27 pages

Vcsharphtp6 02

Uploaded by

tala.rateb.learn
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/ 27

Introduction to Visual Studio

and Visual Programming


Chapter 2 of Visual C# How to Program, 6/e

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.1 Introduction
 Visual Studio is Microsoft’s Integrated Development Environment
(IDE) for creating, running and debugging apps (also called
applications) written in C# and various other .NET programming
languages.
 In this chapter, we overview the Visual Studio Community 2019 IDE,

then show how to create a simple Visual C# app by dragging and


dropping predefined building blocks into place—a technique known as
visual app development.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.2.2 Visual Studio Themes
 VisualStudio supports three themes that specify the IDE’s
color scheme:
 a dark theme (with dark window backgrounds and light text)
 a light theme (with light window backgrounds and dark text) and
 a blue theme (with light window backgrounds and dark text).
 We use the blue theme throughout this book.
 The Before You Begin section after the Preface explains how

to set this option.

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.2.4 Creating a New Project
A project is a group of related files, such as the Visual C#
code and any images that might make up an app.
 Visual Studio organizes apps into projects and solutions,

which contain one or more projects.


 Multiple-project solutions are used to create large-scale apps.
 You select File > New > Project… to create a new project or
File > Open > Project/Solution… to open an existing one.
 You also can click the corresponding links in the Start

Page’s Start section.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.2.5 New Project Dialog and Project Templates
 For the discussions in the next several sections, we’ll create
a new project. Select File > New > Project… to display the
New Project dialog (Fig. 2.3).
 Dialogs are windows that facilitate user–computer

communication.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
© 2018 Pearson Education, Ltd. All Rights Reserved.
2.2.6 Forms and Controls
 The rectangle in the Design area titled Form1 (called a Form)
represents the main window of the Windows Forms app.
 Each Form is an object of class Form in the .NET Framework Class

Library.
 Apps can have multiple Forms (windows).
 A Label typically contains descriptive text (for example, "Welcome to

Visual C#!"), and a PictureBox displays an image.


 Visual Studio has many preexisting controls and other components you

can use to build and customize your apps.


 Collectively, the Form and controls make up the app’s GUI.

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.2.6 Forms and Controls
 Each open document’s name is listed on a tab. To view a
document when multiple documents are open, click its tab.
 The active tab (the tab of the currently displayed

document) is highlighted.
 The active tab’s highlight color depends on the Visual Studio

theme—the blue theme uses a yellow highlight and the light


and dark themes use a blue highlight.

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.3 Menu Bar and Toolbar
 Commands for managing the IDE and for developing, maintaining and
executing apps are contained in menus, which are located on the menu
bar of the IDE (Fig. 2.5).
 The set of menus displayed depends on what you’re currently doing in the IDE.
 Menus contain groups of related commands called menu items that,
when selected, cause the IDE to perform specific actions.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.3 Menu Bar and Toolbar
 You can access many common menu commands from the
toolbar (Fig. 2.7), which contains icons that graphically
represent commands.
 By default, the standard toolbar is displayed when you run

Visual Studio for the first time—it contains icons for the
most commonly used commands, such as opening a file,
saving files and running apps.
 The icons that appear on the standard toolbar may vary, depending
on the version of Visual Studio you’re using.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.4 Navigating the Visual Studio IDE
 The IDE provides windows for accessing project files and customizing
controls. Each can be accessed by selecting its name in the View menu.
 Visual Studio provides an auto-hide space-saving feature.
 When auto-hide is enabled for a window, a tab containing the window’s name
appears along the IDE window’s left, right or bottom edge (Fig. 2.10).
 Clicking the name of an auto-hidden window displays that window (Fig. 2.11).
 Clicking the name again (or clicking outside) hides the window.
 To “pin down” a window (that is, to disable auto-hide and keep the
window open), click the pin icon.
 When auto-hide is enabled, the pin icon is horizontal
 When a window is “pinned down,” the pin icon is vertical

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
© 2018 Pearson Education, Ltd. All Rights Reserved.
© 2018 Pearson Education, Ltd. All Rights Reserved.
2.4.1 Solution Explorer
 The Solution Explorer window (Fig. 2.13) provides access
to all of a solution’s files.
 If it’s not shown in the IDE, select View > Solution

Explorer.
 When you open a new or existing solution, the Solution

Explorer displays the solution’s contents.

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.4.1 Solution Explorer
 The solution’s startup project (shown in bold in the Solution
Explorer) is the one that runs when you select Debug > Start
Debugging (or press F5) or select Debug > Start Without Debugging
(or press Ctrl + F5 key).
 For a single-project solution, the startup project is the only project.
 When you create an app for the first time, the Solution Explorer

window appears as shown in Fig. 2.13.


 The Visual C# file that corresponds to the Form shown in Fig. 2.4 is

named Form1.cs (selected in Fig. 2.13).


 Visual C# files use the .cs file-name extension, which is short for “C#.”

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.4.2 Toolbox
 To display the Toolbox window, select View > Toolbox.
 Contains the controls used to customize Forms (Fig. 2.15).
 With visual app development, you can “drag and drop” controls onto
the Form and the IDE will write the code that creates the controls for
you.
 The Toolbox groups the prebuilt controls into categories—All

Windows Forms, Common Controls, Containers, Menus & Toolbars,


Data, Components, Printing, Dialogs, Reporting, WPF
Interoperability and General.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.4.3 Properties Window
 If the Properties window is not displayed below the Solution Explorer,
select View > Properties Window to display it.
 The Properties window contains the properties for the currently

selected Form, control or file in the IDE.


 Properties specify information about the Form or control.
 When you select a property, its description is displayed at the bottom

of the Properties window.

© 2018 Pearson Education, Ltd. All Rights Reserved.


2.4.3 Properties Window
 Fig. 2.16 shows Form1’s Properties window—you can view by
clicking anywhere in the Form1.cs [Design] window.
 The left column lists the Form’s properties
 The right column displays the current value of each property.
 You can sort the properties either
 alphabetically (by clicking the Alphabetical icon) or
 categorically (by clicking the Categorized icon).
 The Properties window is crucial to visual app development.

© 2018 Pearson Education, Ltd. All Rights Reserved.


© 2018 Pearson Education, Ltd. All Rights Reserved.
2.5 Help Menu and Context-Sensitive Help
 Microsoft provides extensive help documentation via the Help menu,
which is an excellent way to get information quickly about Visual
Studio, Visual C# and more.
 Visual Studio provides context-sensitive help pertaining to the

“current content” (that is, the items around the location of the mouse
cursor).
 To use context-sensitive help, click an item, then press the F1 key.

© 2018 Pearson Education, Ltd. All Rights Reserved.

You might also like