2007 1219 Mouse events Menus Keyboad events Events
2007 12/19 Mouse events Menus Keyboad events
Events (of the form) Mouse. Move event Mouse. Leave event Mouse. Double. Click event Properties Mouse. Event. Args. X Mouse. Event. Args. Y Mouse. Event. Args. Button Form. Text …. this. Text Method Form. Close … this. Close() Mouse. exe Mouse. Event. Args e
Menu. exe 1) Add Menu. Strip control 2) Show messages (See Click. Event) 3) Due to define its access key, add “&” in front of the symbol “h” of “help (h)” …… “help (&h)” 4) Change Tool. Strip. Menu. Item. Shortcut property.
1) Add Context. Menu. Strip control 2) Change Context. Menu. Strip property of button 1. and select the context menu. 3) Use Form. Close and close the form.
Ex. help 1 Tool. Strip. Menu. Item 4) Call the same event handler help 1 Tool. Strip. Menu. Item_Click help 2 Tool. Strip. Menu. Item. Click Event += new Event. Handler (help 1 Tool. Strip. Menu. Item_Click); Event Handler Ex. help 2 Tool. Strip. Menu. Item
Keyboard events Key. exe private void text. Box 1_Key. Down(object sender, Key. Event. Args e) { Enter and Esc keys work if (e. Key. Code == Keys. Enter) …. only in the text. Box private void Form 1_Key. Down(object sender, Key. Event. Args e) { if (e. Key. Code == Keys. F 1) F 1 and F 12 keys work everywhere on the form this. Key. Preview = true; ↑Form 1
F 12 Message. Box again – return value of Message. Box enumeration Dialog. Result dr = Message. Box. Show("Quit? ", "Are you sure? ", Message. Box. Buttons. ? ? , Message. Box. Icon. ? ? ? ); // dr: the return value // Message and caption // Type of the Message. Box // Icon of the Message. Box if (dr == Dialog. Result. ? ? ? )…… Possible values of Dialog Result dr: Abort, Cancel, Ignore, None, OK, Retry, Yes
Notice 12/19 3 exercises 12/11 3 exercises 12/05 none (forget this) 11/28 1 exercise (saving & loading files) 11/21 1 exercise (launcher) [ 12/26, 01/02 ] 1) Finish all the exercises and show me. 2) Finish your tiny projects. [2007 01 /0 4 23: 59] Deadline of tiny projects: Hand in : 1) Zipped file (compress the folder of your project) 2) Read. Me file
- Slides: 8