1. Trang chủ
  2. » Giáo án - Bài giảng

Chapter Control

77 247 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 77
Dung lượng 1,09 MB

Nội dung

Chapter 2: Control 9:06:37 AM Adding Controls to a Windows Form (page 110) • Adding Controls by Using the Windows Forms Designer • Adding Controls Programmatically 9:06:37 AM Adding Controls Programmatically (page 112, 113) • 1. Create a private variable to represent each of the controls you want to place on the form • 2. In the form, place code to instantiate each control and to customize each control, using its properties, methods, or events. • 3. Add each control to the forms control collection. 9:06:37 AM Exam (page 113) 9:06:37 AM Home work Ex: page 113 9:06:37 AM Handling Control Events • Add controls to a Windows form. – Set properties on controls. – Load controls dynamically. – Write code to handle control events and add the code to a control. See TextBook page 127 9:06:37 AM HANDLING CONTROL EVENTS (page 122 - 124) 9:06:37 AM HANDLING CONTROL EVENTS (page 123) See TextBook page 127 COMMON WINDOWS FORMS CONTROLS 9:06:37 AM COMMON WINDOWS FORMS CONTROLS [...]... Forms Control Properties and Layout • Common properties – Derive from class Control – Text property • Specifies the text that appears on a control – Focus method • Transfers the focus to a control • Becomes active control – Enable property • Indicate a control s accessibility Control Properties and Layout • Visibility control – Hide control from user • Or use method Hide • Anchor property – Anchoring control. .. control moves relative to the position – Docking allows control to spread itself along and entire side – Both options refer to the parent container • Size structure – Allow for specifying size range • MinimumSize and MaximumSize property Control Properties and Layout Control Properties and Layout Before resize After resize Constant distance to left and top sides Fig 12.11 Anchoring demonstration Control. .. demonstration Control Properties and Layout Darkened bar indicates to which wall control is anchored Click down-arrow in Anchor property to display anchoring window Fig 12.12 Manipulating the Anchor property of a control Control Properties and Layout Control expands along top portion of the form Fig 12.13 Docking demonstration Control Properties and Layout 2 Labels, LinkLabel (p 137) • Labels (important... RichTextBox – SelectionColor – SelectionFont 3 The PictureBox Control 4 GroupBoxes and Panels • Arrange components on a GUI – GroupBoxes can display a caption • Text property determines its caption – Panels can have scrollbar • View additional controls inside the Panel GroupBoxes and Panels GroupBoxes and Panels (p 143) GroupBoxes and Panels Controls inside panel panel panel scrollbars Fig 12.21 Creating... selected font Property ShowEffects whether the dialog box contains controls that allow the user to specify strikethrough, underline,Color Property Color: Gets or sets the selected font color Method Showdialog(): ColorDialog ColorDialog a Property Color : get/set color select by the user b Property FullOpen: True/false, whether the controls used to create custom colors are visible when the dialog box...Naming Rules • Always use standard names for objects • No spaces or punctuation marks • 3 letter lowercase prefix identifies control type • Button-btn • Label-lbl • Form-frm • If multiple words capitalize 1st letter of each word • Each object name is an identifier • Can contain letters, digits, and underscores (_) • Cannot start . TextBook page 127 9:06 :37 AM HANDLING CONTROL EVENTS (page 122 - 124 ) 9:06 :37 AM HANDLING CONTROL EVENTS (page 1 23 ) See TextBook page 127 COMMON WINDOWS FORMS CONTROLS 9:06 :37 AM COMMON WINDOWS FORMS CONTROLS 9:06 :37 . indicates to which wall control is anchored Click down-arrow in Anchor property to display anchoring window 9:06 :37 AM Control Properties and Layout Fig. 12. 13 Docking demonstration. Control. Programmatically (page 1 12, 1 13) • 1. Create a private variable to represent each of the controls you want to place on the form • 2. In the form, place code to instantiate each control and to customize

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

Xem thêm

TỪ KHÓA LIÊN QUAN