TAILIEUCHUNG - Publishing Windows Element Success

Publishing Events in Windows Forms If you are familiar with Microsoft Visual Basic, Microsoft Foundation Classes (MFC), or any of the other tools available for building GUI applications for Windows | Publishing Events in Windows Forms If you are familiar with Microsoft Visual Basic Microsoft Foundation Classes MFC or any of the other tools available for building GUI applications for Windows you are aware that Windows uses an event-driven model to determine when to execute code. In Chapter 16 Delegates and Events you saw how to publish your own events and subscribe to them. Windows Forms and controls have their own predefined events that you can subscribe to and these events should be sufficient to handle most eventualities. Processing Events in Windows Forms Your task as a developer is to capture the events that you feel are relevant to your application and write the code that responds to these events. A familiar example is the Button control which raises a Somebody clicked the button event when a user clicks it with the mouse or presses Enter when the button has the focus. If you want the button to do something you write code that responds to this event. This is what you will do in the final exercise in this chapter. Handle the Click event for the Clear button 1. In Design View on the View menu click Designer select the Clear button on MemberForm. When the user clicks the Clear button you want the form to be reset to its default values. 2. In the Properties window click the Events button. The list of properties is replaced with a list of events that you can intercept. 3. Select the Click event. 4. Type clearClick in the text box and press Enter. A new event method called clearClick is created and displayed in the Code And Text Editor window. Notice that the event method conforms to the convention in that it takes two parameters the sender an object and additional arguments an EventArgs . The Windows Forms runtime will populate these parameters with information about the source of the event and any additional information that might be useful when handling the event. You will not use these parameters in this exercise. 5. In the body of the clearClick method call

TÀI LIỆU MỚI ĐĂNG
9    210    0    28-03-2024
44    181    0    28-03-2024
46    179    0    28-03-2024
14    159    0    28-03-2024
10    148    0    28-03-2024
23    147    0    28-03-2024
24    127    0    28-03-2024
10    112    0    28-03-2024
Đã 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.