TAILIEUCHUNG - Apress Expert C sharp 2005 (Phần 11)

Tham khảo tài liệu 'apress expert c sharp 2005 (phần 11)', 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ả | 2 26 06 10 06 PM Page 474 474 CHAPTER 9 WINDOWS FORMS UI protected internal virtual void OnCurrentPrincipalChanged object sender EventArgs e if CurrentPrincipalChanged null CurrentPrincipalChanged sender e It is both virtual and raises a CurrentPrincipalChanged event declared as follows public event EventHandler CurrentPrincipalChanged If the developer of a user control needs to respond to a login logout event they can either override OnCurrentPrincipalChanged or handle the CurrentPrincipalChanged event. Either way they ll be notified that the CurrentPrincipal property of the Thread object has changed. MainForm The MainForm form is the core of the application in that it provides the menu and status bar and hosts the user controls for display to the user. It coordinates the flow of the entire application. Figure 9-4 shows the layout of MainForm. Figure 9-4. MainForm layout The Resources menu has three items comparable to those in the Projects menu while the Admin menu has a single item Edit Roles. The code behind each of these menu items will be discussed later in the chapter as the business functionality is implemented. For now I want to focus on hosting the user controls the Documents menu the status bar and the Login button. Hosting the User Controls What isn t immediately obvious from Figure 9-4 is that the main region of the form contains a Panel control. All the user controls are actually contained within this Panel control rather than MainForm 2 26 06 10 06 PM Page 475 CHAPTER 9 WINDOWS FORMS UI 475 itself. This is done so that resizing events can be handled more easily and the overall hosting process can be simplified. The Panel control s Dock property is set to Fill so it automatically fills the available space in the form even if the form is resized. Loading Adding User Controls When a new user control is dynamically loaded because the user chooses to view edit a project resource or role it needs to be created added to

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.