Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual...

24
Create A Simple Graphical C# Application Visual Programming-CS411

Transcript of Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual...

Page 1: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Create A Simple Graphical C# Application

Visual Programming-CS411

Page 2: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Create A Simple Graphical C# App

Visual Studio 2012 provides you with two views of a graphical application: the design view and the code view.

You use the Code and Text Editor window to modify and maintain the code and program logic for a graphical application.

You use the Design View window to lay out your user interface.

You can switch between the two views whenever you want.

Page 3: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Create A Simple Graphical C# App

Visual Studio 2012 provides two templates for building graphical

applications:

Windows Forms Application template

WPF Application template

Windows Forms is a technology that first appeared with the .NET

Framework version 1.0.

WPF, or Windows Presentation Foundation, is an enhanced

technology that first appeared with the .NET Framework version

3.0. It provides many additional features and capabilities over

Windows Forms,

Page 4: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

In the following set of exercises, you’ll learn how to create

a graphical application using Visual Studio 2012.

The program will display a simple form containing a text

box where you can enter your name and a button that

when clicked displays a personalized greeting.

Create A Simple Graphical C# App

Page 5: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

FILE New Project

Page 6: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Visual C# WPF App

Page 7: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

XAML and this is automatically add, when you drag and drop anu control. You can also edit the XAML and write code for controls by yourself.

Page 8: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Click The Toolbox Tab

Page 9: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Expand The Common WPF Controls Section

Page 10: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Click TextBlock

Page 11: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Drag The Textblock Control Onto The Form

Page 12: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Adjust The Size And Position of Textblock Control Onto The Form

Properties Window

Page 13: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Expand the Text property & Change the FontSize property to 20 px

Page 14: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Change the value of the Text property to Please enter your name

Page 15: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms
Page 16: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Add TextBox control , Edit Name and Text property

Page 17: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Add Button control , Edit Name and Content property

Page 18: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Change the Title property of the title bar of the form

Page 19: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Output

Page 20: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms

Add Event to OK button

Page 21: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms
Page 22: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms
Page 23: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms
Page 24: Create A Simple Graphical C# Application A Simple... · Create A Simple Graphical C# App Visual Studio 2012 provides two templates for building graphical applications: Windows Forms