Chapter 1 Introduction to the Visual Studio 2005

19 333 0
Chapter 1 Introduction to the Visual Studio 2005

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter üIntroduction to the Visual Studio 2005 INTRODUCTION § Included in Visual Studio.NET Ÿ Ÿ Ÿ Ÿ Ÿ Visual Basic (VB.Net, VB 7.0) C++ C# (đọc C Sharp) J# (J Sharp) NET Framework CÀI ĐẶT Visual Studio.NET 2005 § Chạy file setup.exe ta hình minh họa (chú ý cài lâu giờ) CÀI ĐẶT Visual Studio.NET 2005 Nhấn Next CÀI ĐẶT Visual Studio.NET 2005 § Thường Key có sẵn Nhấn Next CÀI ĐẶT Visual Studio.NET 2005 Lựa chọn yêu cầu phần khoảng trống ổ cứng Chú ý CÀI ĐẶT Visual Studio.NET 2005 •Cài đặt phần tốn nhiều thời gian CÀI ĐẶT MSDN (Help) Cài đặt MSDN độc lập cài sau cài Visual Studio 2005 CÀI ĐẶT MSDN (Help) CÀI ĐẶT MSDN (Help) 10 CÀI ĐẶT MSDN (Help) •Nên chọn full 11 CÀI ĐẶT MSDN (Help) 12 CÀI ĐẶT MSDN (Help) 13 CÀI ĐẶT MSDN (Help) 14 Introduction § Visual Studio NET Ÿ Framework Ÿ Microsoft’s Integrated Development Environment (IDE) 15 The NET Framework § The Common Language Runtime (CLR) is another central part of the NET Frameworkit executes NET programs § The NET Framework Class Library (FCL) can be used by any NET language 16 The Net Framework Understanding the NET Framework Architecture 17 Understanding the Common Language Runtime Common Language Runtime Architecture 18 Programming Languages § Procedural Ÿ Program specifies exact sequence § Event Driven § Object Oriented Programming (C#.NET) Ÿ User controls sequence Click event Double Click event Change event 19 Quá trình biên dịch chạy chương trình NET C# Code C# Compiler Visual Basic Code VisualBasic Compiler COBOL Code COBOL Compiler IL JIT Compiler Native Code 20 Object Model § Object ==> Like a Noun in English Ÿ Form and Controls on forms (Button, Text boxes…) § Property ==> Like Adjective,they describe object Ÿ Text, Name, BackColor, Font and Size § Method ==> Like Verb, They are actions that objects exhibit § Event ==> Occur when the user takes action Ÿ User clicks a button § Class ==> Template to create new object Ÿ Each control added is an Instance of a Class (Example: adding a second form to the project – it will have the same properties) 21 Dot Notation § Used to reference object's properties and methods in code Ÿ Object dot Property Form.Text, TextBox.Text (Example: lblMessage.Text = "Hello World“) Ÿ Object dot Method Form.Hide( ), TextBox.Focus( ) § To reference an object's events use an underscore instead of a dot Button_Click, ListBox_TextChanged private void btnHoLot_Click(object sender, EventArgs e) { // statement } 22 INTRODUCTION § C#.NET supports programming projects that run in both Windows desktop and Internet environments We will focus on the Windows desktop § Both of these environments are based on what is termed a graphical user interface or GUI for short 23 Steps for Writing C# § Design/Define the User Interface § Plan/Set the Properties § Plan/Write the Code § Test and Debug 24 Visual Studio NET Integrated Development Environment (IDE) Overview 25 Visual Studio NET Integrated Development Environment (IDE) Overview Visual C# projects folder Visual C# Windows Application (selected) project name project location 26 IDE Main Window § Toolbars § Document Window § Form Designer § Solution Explorer § Properties Window § Toolbox 27 Visual Studio NET Integrated Development Environment (IDE) Overview menu title bat tabs menu bar active tab Solution Explorer Form (windows application) Properties window 28 Toolbox toolbox group § Holds the tools you place on a form controls scroll arrow 29 Menu Bar and Toolbar toolbar icon (indicates a command to open a file) toolbar down arrow indicates additional commands 30 Solution Explorer Toolbox Solution Explorer Properties 31 Solution Explorer 32 Solution Explorer § The Solution Explorer Ÿ Lists all files in the solution Ÿ Displays the contents or a new project or open file Ÿ The start up project is the project that runs when the program is executed It appears in bold in the Solution Explorer Ÿ The plus and minus images expand and collapse the tree Can also double click on the file name to expand/collapse Ÿ Solution Explorer toolbar The Refresh icon reloads files in the solution The Display icon shows all files, even the hidden ones Icons change based on selected file 33 Solution Explorer Refresh Display all files Properties window Startup project Collapse tree Expand tree 34 Properties window § The Properties window Ÿ Manipulate the properties of a form or control Ÿ Each control has its own set of properties Properties can include size, color, text, or position Ÿ Right column is the property Ÿ Left column is the property value Ÿ Icons The Alphabetic icon arranges the properties alphabetically The Categorized icon arranges the properties by category The Event icon allows reactions to user actions Ÿ Users alter controls visually without writing code Ÿ The component selection dropdown list shows what control is 35 being altered and what other controls can be altered Slide 35 Properties Window Characterized icon Component selection Event icon Alphabet icon Scroll bar Property Current value Description 36 â Using Help Đ Help menu Ÿ Index Displays an alphabetic index that users can browse through Ÿ Search Allows users to search for a particular help topic Filters can be use to narrow the search § Dynamic help Ÿ Provide a help topic based on the mouse location Ÿ Displays relevant topics in the dynamic help window Ÿ Lists help entries, samples, and “getting started” topics § Context-Sensitive help Ÿ Automatically brings up relevant help topics 37 Slide 37 © Using Help Dynamic Help window Fig 2.13 Dynamic Help window 38 Slide 38 © Naming Rules § Always use standard names for objects § No spaces or punctuation marks § letter lowercase prefix identifies control type Button-btn Label-lbl Form-frm § If multiple words capitalize 1st letter of each word 39 Recommended Naming Conventions for C# Objects Object Class Form Button TextBox Label Radio Button CheckBox Horizontal ScrollBar Vertical ScrollBar PictureBox ComboBox ListBox Prefix frm btn txt lbl rad chk hsb vsb pic cbo lst Example frmDataEntry btnExit txtPaymentAmount lblTotal radBold chkPrintSummary hsbRate vsbTemperature picLandscape cboBookList lstIndegredients 40 Ví Dụ Đặt Tên lblMessage btnPush btnExit 41 Sinh Viên Hãy Đặt Tên Sau Name ? Name ? Name ? Name ? Name ? 42 Simple Program: Displaying Text and an Image § The program Ÿ Ÿ Ÿ Ÿ Form to hold other controls Label to display text PictureBox to display a picture No code needed to create this program § Create the new program Ÿ Create a new project Make the project a windows application Name it: ASimpleProject and sets its location § Set the form’s title bar Ÿ The Text property determines the text in the title bar Ÿ Set the value to: A Simple Program 43 Slide 43 © Ví dụ Simple Program: Displaying Text and an Image 44 Simple Program: Displaying Text and an Image Project type Project name Project location Click to change project location 45 Simple Program: Displaying Text and an Image Select project location Click to set project location 46 Simple Program: Displaying Text and an Image Name and type of object Selected property Property value Property description 47 Simple Program: Displaying Text and an Image Title bar grid Disabled sizing handle Mouse pointer over a sizing handle Enabled sizing handle 48 Simple Program: Displaying Text and an Image Current color Custom palette Down arrow 49 Simple Program: Displaying Text and an Image Label control New background color 50 Simple Program: Displaying Text and an Image Label centered with updated Text property 51 Simple Program: Displaying Text and an Image Updated Label New PictureBox 52 Simple Program: Displaying Text and an Image Newly inserted image (after resizing the picture box) 53 Simple Program: Displaying Text and an Image Start button Run mode Design form End button Design form (grid) Running application 54 Ví Dụ Có cần đặt lại tên ???? Có cần đặt lại tên ???? lblKQua btnVN btnClose btnEng btnSpan 55 Code Cho Nút English private void btnEngLish_Click(object sender, EventArgs e) { lblKQ.Text = "Hello"; } 56 ... ĐẶT Visual Studio. NET 2005 Nhấn Next CÀI ĐẶT Visual Studio. NET 2005 § Thường Key có sẵn Nhấn Next CÀI ĐẶT Visual Studio. NET 2005 Lựa chọn yêu cầu phần khoảng trống ổ cứng Chú ý CÀI ĐẶT Visual Studio. NET... MSDN (Help) 12 CÀI ĐẶT MSDN (Help) 13 CÀI ĐẶT MSDN (Help) 14 Introduction § Visual Studio NET Ÿ Framework Ÿ Microsoft’s Integrated Development Environment (IDE) 15 The NET Framework § The Common... Allows users to search for a particular help topic Filters can be use to narrow the search § Dynamic help Ÿ Provide a help topic based on the mouse location Ÿ Displays relevant topics in the dynamic

Ngày đăng: 13/05/2014, 11:30

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan