Danh mục

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

Số trang: 33      Loại file: pptx      Dung lượng: 354.44 KB      Lượt xem: 12      Lượt tải: 0    
10.10.2023

Phí lưu trữ khi tải xuống: 15,000 VND Tải xuống file đầy đủ (33 trang) 0
Xem trước 4 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Chapter 3 (Cont’d) introduction to the Windows programming. In this chapter present the some common controls as: Button; label, LinkLabel; TextBox ( + ErrorProvider component), RichTextBox; GroupBox, panel; CheckBox, RadioButton; PictureBox, ImageList;... Inviting you to refer.
Nội dung trích xuất từ tài liệu:
Lecture Windows programming: Chapter 3(2) - Châu Thị Bảo Hà Chapter 3 WindowsProgramming Cont’d 1 Contents• Introduction to Windows Form Application• Introduction to Form• Introduction to Control• Events• Some common Controls• Some advanced Controls Slide 2 Naming rules• Each control has an identifier (Name property) – can contain letters, digits, and underscores (_) – cannot start with digits – can start with the @ symbol – no spaces or punctuation marks• If multiple words capitalize 1st letter of each word• 3 letter lowercase prefix identifies control type Slide 3 Recommended namingObject Class Prefix ExampleForm frm frmDataEntryButton btn btnExitTextBox txt txtPaymentAmountLabel lbl lblTotalRadioButton rad radBoldCheckBox chk chkPrintSummaryPictureBox pic picLandscapeComboBox cbo cboBookListListBox lst lstIndegredientsGroupBox grb grbColor Slide 4 Some common Controls1. Button2. Label, LinkLabel3. TextBox ( + ErrorProvider component), RichTextBox4. GroupBox, Panel5. CheckBox, RadioButton6. PictureBox, ImageList7. ListBox, CheckedListBox8. ComboBox Slide 5 Button (p.453)• Allows the user to click it to perform an action – some properties: • FlatStyle • Image • ImageAlign • Text • TextAlign – default event: • Click event: happens whenever a user clicks the button Slide 6 Label (p.456)• To display text or images that cannot be edited by the user – some properties: • AutoSize • BorderStyle • Font • Image • ImageAlign • Text • TextAlign Slide 7 LinkLabel (p.456)• To add Web-style links to applications – some properties: • ActiveLinkColor • LinkArea • LinkColor • LinkVisited • VisitedLinkColor Slide 8 TextBox (p.457)• To enter text or display information – some properties: • CausesValidation: true/false • CharacterCasing: Normal/Upper/Lower • MaxLength • Multiline: true/false • PasswordChar • ReadOnly: true/false • ScrollBars • WordWrap: true/false Slide 9 TextBox (cont.) – some events: • TextChanged • Enter • Leave These events occur in this order • Validating • Validated KeyDown and KeyUp receive the key code • KeyDown corresponding to the key that was pressed. KeyPress receives the character corresponding to a • KeyPress keyboard key. • KeyUp• Try it out - Working with a TextBox Slide Control 10 The ErrorProvider component• You can display an error to alert the user about invalid data input by using ErrorProvider component • BlinkRate property • BlinkStyle property • ContainerControl property • GetError() method • Icon property • SetError() method • SetIconAlignment() method • SetIconPadding() method Slide11 Demo: Validating and Validated event • Example:private void txtNumber1_Validating(object sender, CancelEventArgse) { if (Convert.ToInt32(txtNumber1.Text) < 0) { e.Cancel = true; // cancel the event errorProvider1.SetError(txtNumber1, “this is not a valid number); txtNumber1.SelectAll(); }}private void txtNumber1_Validated(object sender, EventArgs e) { errorProvider1.SetError(txtNumber1, ); Slide12Demo: Validating and Validated event Slide 13Demo: KeyPress event Slide 14 RichTextBox (p.470)• Used for displaying, entering, and manipulating text with more formatting (display fonts, colors, and links; load text and embedded images from a file; undo and redo editing operations; and find specified characters) – some properties (p.471): • SelectedText • SelectionAlignment • SelectionColor • SelectionFont Slide 15 GroupBox, Panel• Arrange components on a GUI – GroupBox can display a caption (p.466) • Text property: determines its caption – Panel can have scrollbar • AutoScroll property • BorderStyle property ...

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

Tài liệu liên quan: