Danh mục

Lecture Windows programming: Chapter 3(1) - Châu Thị Bảo Hà

Số trang: 21      Loại file: pptx      Dung lượng: 451.38 KB      Lượt xem: 9      Lượt tải: 0    
10.10.2023

Xem trước 3 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Chapter 3 introduction to the Windows programming. This chapter presents contents: introduction to windows form application, introduction to form, introduction to control, events, some common controls, some advanced controls.
Nội dung trích xuất từ tài liệu:
Lecture Windows programming: Chapter 3(1) - Châu Thị Bảo Hà Chapter 3 WindowsProgramming 1 Contents• Introduction to Windows Form application• Introduction to Form• Introduction to Control• Events• Some common Controls• Some advanced Controls Slide 2Create a Windows Form application Slide 3 Programming interface• Review – Solution Explorer – Toolbox – Properties Window Slide 4 Contents• Introduction to Windows Form Application• Introduction to Form• Introduction to Control• Events• Some common Controls• Some advanced Controls Slide 5 Introduction to Form• Form (also called Windows Form) – is a container for controls and components – belongs to System.Windows.Forms namespace• Some actions with Form – To add a new Form: right-click to the project shown in Solution Explorer, select AddWindows Form – To add a existing Form: right-click to the project shown in Solution Explorer, select AddExisting Item (choose file .cs) – To exclude a Form: right-click to the form shown in Solution Explorer, select Exclude Slide 6 Common Form properties and Form methods Desc rip tionCommonProperties Borderoftheform(e.g.,none,single,3D,FormBorderStyle sizable). Fontoftextdisplayedontheform,aswellasFont thedefaultfontofcontrolsaddedtotheform.Text Textintheform’stitlebar. DeteminesthepositionofaformwhenitfirstStartPosition appearsWindowState DeteminestheinitialvisualstateoftheformCommonMethods Closesformandreleasesallresources.AclosedClose formcannotbereopened.Hide Hidesform(doesnotreleaseresources).Show Displaysahiddenform. Slide 7 Contents• Introduction to Windows Form Application• Introduction to Form• Introduction to Control• Events• Some common Controls• Some advanced Controls Slide 8 Introduction to Control• Control – is a component with graphical part, such as button, label… – is visible• Controls belong to System.Windows.Forms namespace – Most controls derive from the System.Windows.Forms.Control class• How to add a control to a form? Slide 9 Add a control to a Form• By using the Windows Forms Designer – Select a control and draw it on the container surface – Drag a control onto the form at the desired location – Add a control to a form by double clicking it See – Copy/Paste a control to a form generated code• By programmatically – Create a control object and add it to the container – Example: Slide 10 Common properties and methodsPROPERTY of Controls (p.499) DESCRIPTIONAnchor Specifies how the control behaves when its container is resizedBackColor The background color of a controlDock Docks a control to the edges of its containerEnabled Specifies whether the control receive input from the userForeColor The foreground color of the controlName The name of the controlTabIndex The number the control has in the tab order of its containerTabStop If true, user can use the Tab key to select the controlText Holds the text that is associated with this controlVisible Specifies whether the control is visible at runtimeMETHOD DESCRIPTIONHide Hides the controlShow Shows the controlFocus Transfers the focus to a control Slide 11 Anchor propertyDesign Darkenedbarindicates towhichwallcontrol isanchored Clickdownarrow inAnchorproperty todisplay anchoringwindowResult Constantdistance toleftandtopsid ...

Tài liệu được xem nhiều: