Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 28 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
28
Dung lượng
622 KB
Nội dung
Week 1
Chapter 1: WindowsFormsandthe
User Interface
Chapter 2: Configuring Controls
1
Chapter 1: WindowsForms
and theUser Interface
Lesson 1: Adding and configuring Windows Forms
Adding Forms to the project
Properties of Windows Forms
Creating non-rectangular Windows Forms
Lesson 2: Managing control layout with container
controls
Slide 2
Adding Forms to the project
At design time
To add a new Form: right-click to the project shown in
Solution Explorer, select Add\Windows Form
To add a existing Form: right-click to the project
shown in Solution Explorer, select Add\Existing Item
(choose file .cs)
At run time
Form1 myForm;
myForm = new Form1();
myForm.Show();
Chapter 1 - Lesson 1: Adding and configuring Windows Forms
Slide 3
Properties of Windows Forms
Note:
p.11
p.9
p.11
Chapter 1 - Lesson 1: Adding and configuring Windows Forms
Slide 4
Properties of WindowsForms
(cont.)
AcceptButton property
CancelButton Property
p.11
p.10
Chapter 1 - Lesson 1: Adding and configuring Windows Forms
Slide 5
Create a non-rectangular form
(p.15)
For advanced visual effects
To create a non-rectangular form:
In Form_Load event, change the Region property
Create a new instance of the GraphicsPath class (in
System.Drawing.Drawing2D namespace)
Create the new Region from it
Chapter 1 - Lesson 1: Adding and configuring Windows Forms
A GraphicsPath represents a series of
connected lines and curves
A GraphicsPath may be composed of any
number of figures, like ellipse
Slide 6
Example: Create a non-rectangular
form
GraphicsPath myPath = new GraphicsPath();
// Adds an ellipse to the graphics path that inscribes
// the rectangle defined by the form's width and height
myPath.AddEllipse(0, 0, this.Width, this.Height);
// Creates a new Region from the GraphicsPath
Region myRegion = new Region(myPath);
// Sets the form's Region property to the new region
this.Region = myRegion;
Chapter 1 - Lesson 1: Adding and configuring Windows Forms
Exercise 1,2 p.16,p.17
Slide 7
Managing control layout with
container controls
Container controls
Panel control
GroupBox control
TabControl control
SplitContainer control
FlowLayoutPanel control
TableLayoutPanel control
Exercise: Practice with Container Controls (p.35-38)
Chapter 1 - Lesson 2: Managing control layout with container controls
Slide 8
Panel control (p.26)
Scrollable control
Supports horizontal and vertical scroll bars
No caption
Chapter 1 - Lesson 2: Managing control layout with container controls
Slide 9
GroupBox control (p.25)
Does not provide scrollbars
Have a caption (Text property)
The most common use: grouping RadioButton
controls
Chapter 1 - Lesson 2: Managing control layout with container controls
Slide 10
[...]... Creating and Configuring command and text controls Slide 21 Button control (cont.) Button control: Mouse events: MouseDown (p.64) Demo p.64 Some other controls are the same Chapter 2 - Lesson 2: Creating and Configuring command and text controls Slide 22 TextBox control (p.73) TextBox control properties Exercise 5, 6 Module 1 Chapter 2 - Lesson 2: Creating and Configuring command and text... Controls in WindowsForms Slide 17 Smart Tags (p.56) Some controls expose their most common tasks through smart tags When present, smart tags appear as small boxes in the upper right-hand corner of the control A Combo box with a smart tag Chapter 2 - Lesson 1: Configuring Controls in WindowsForms Slide 18 Document Outline Window Document Outline Window (p.57) Displays all of the controls and container... TableLayoutPanel can hold the other TableLayoutPanel control Columns or Rows property: set the size of the rows and columns Chapter 1 - Lesson 2: Managing control layout with container controls Slide 14 Chapter 2: Configuring Controls Lesson 1: Configuring Controls in WindowsForms Modify the size, location of a control at design time Anchor, dock a control within a Windows Form or other container... container controls in a form View\Other Windows\ Document Outline Use for Move controls from one container to another To delete controls from the form To add a control to a container (copy/paste) Chapter 2 - Lesson 1: Configuring Controls in WindowsForms Slide 19 Best practices for user interface design (p.58) Simplicity Position of controls Consistency Aesthetics Slide 20 Button control... container control Modify control properties by using SmartTags Manage the allocation of controls in a Windows Form by using the Document Outline window Lesson 2: Creating and Configuring command and text controls Slide 15 Layout toolbar Adjust controls with Layout toolbar (p.51) Chapter 2 - Lesson 1: Configuring Controls in WindowsForms Slide 16 Common Properties of Controls Common properties of... FlowLayoutPanel will locate in the upper left-hand corner and then flow to the right WrapContents property If WrapContents is set to True (default), controls will automatically wrap to the next column or row Chapter 1 - Lesson 2: Managing control layout with container controls Slide 13 TableLayoutPanel control (p.28) TableLayoutPanel is a table that provides cells for the individual control ... access keys for other controls Set next TabIndex value Demo Chapter 2 - Lesson 2: Creating and Configuring command and text controls Slide 24 LinkLabel control LinkLabel control (p.67) Like Label control Allows you to create a Web-style link in your form that opens a Web page or performs some other action when clicked Contains a variety of properties that allow you to configure the LinkLabel... Chapter 2 - Lesson 2: Creating and Configuring command and text controls Slide 25 MaskTextbox control MaskTextbox control (p.75) MaskTextbox control is a modified TextBox Allows to define a preset pattern for accepting or rejecting user input The Mask property: allows you to define a string that represents the required format of an input string Important properties of the MaskedTextBox are shown... control Some important properties of the TabControl control and TabPage control (p 36-37) Chapter 1 - Lesson 2: Managing control layout with container controls Slide 11 SplitContainer control (p.33) The SplitContainer control creates a subsection of the form Splitter divides the SplitContainer into two SplitterPanel SplitterPanel like Panel control By default, the Dock property of SplitContainer... required format of an input string Important properties of the MaskedTextBox are shown in Table 2-7 Chapter 2 - Lesson 2: Creating and Configuring command and text controls Slide 26 MaskTextbox control (cont.) Mask property Chapter 2 - Lesson 2: Creating and Configuring command and text controls Slide 27 Examples of Mask Strings Slide 28 . 1
Chapter 1: Windows Forms and the
User Interface
Chapter 2: Configuring Controls
1
Chapter 1: Windows Forms
and the User Interface
Lesson 1: Adding and configuring. Adding and configuring Windows Forms
Adding Forms to the project
Properties of Windows Forms
Creating non-rectangular Windows Forms
Lesson 2: Managing