tailieunhanh - Manning Windows Forms Programming (phần 7)
Tham khảo tài liệu 'manning windows forms programming (phần 7)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | This ensures that any new objects added to the project will be created with this namespace. With this change in place we can create our base form. Here we will just create the form and its controls. Later in this section we will create some infrastructure that will be useful in our derived forms later in the chapter. Create the BaseEditDlg form Action Result 2 Add a new Form to the MyPhotoAlbum project called BaseEditDlg 3 Add the three buttons to the form. Assign their settings and position as shown. Settings Button OK Reset Cancel Property Name DialogResult Text Name Text Name DialogResult Text Value btnOk OK OK btnReset Reset btnCancel Cancel Cancel The new class appears in the Solution Explorer window and the Design window is displayed. 4 Add a Panel to the top of the form. Settings Property BorderStyle Modifiers Value FixedSingle Protected Note The Modifiers property used here establishes the accessibility level of the control. The three buttons use the default setting of Private. The Protected setting creates a protected control so that it can be modified in subclasses. 266 chapter 9 Basic controls 5 Create the BaseEditDlg form continued Action Result Set the properties for the BaseEditDlg form to make it a dialog box. Settings Property AcceptButton CancelButton FormBorderStyle MaximizeBox MinimizeBox ShowInTaskBar Size Value btnOk btnCancel FixedDialog False False False 300 320 The code generated here is similar to code we have seen for other forms in our application. The one exception is the panell control. The three buttons are defined as private controls as have all the controls we created in earlier chapters. The panell object is a protected control. As we shall see this will allow our child forms to modify the settings of this panel and in particular change its size to accommodate the desired collection of controls. namespace summary Base form window. summary public class BaseEditDlg private
đang nạp các trang xem trước