Computer Science Visual Programming C Dr Al Hussien

  • Slides: 25
Download presentation
Computer Science Visual Programming (C#) Dr. Al Hussien Seddik Saad Dept. of Computer Science

Computer Science Visual Programming (C#) Dr. Al Hussien Seddik Saad Dept. of Computer Science Faculty of Science Minia University A. H. Seddik 1

Computer Science From Events A. H. Seddik 2

Computer Science From Events A. H. Seddik 2

Lecture (2) Visual Programming (C#) Form Events Double click on the form to activate

Lecture (2) Visual Programming (C#) Form Events Double click on the form to activate the event Form 1_Load (Default Event of the form) A. H. Seddik 3

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Double click on event to

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Double click on event to activate it A. H. Seddik 4

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Runs the code when the

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Runs the code when the form is clicked by the mouse Double Click on the event A. H. Seddik 5

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Also you can try the

Lecture (2) Visual Programming (C#) Form Events (Contd. ) Also you can try the rest of these events A. H. Seddik 6

Lecture (2) Visual Programming (C#) Modifying Form Properties using Events Example, the form changes

Lecture (2) Visual Programming (C#) Modifying Form Properties using Events Example, the form changes its text (Title) when clicked or changes its color etc. A. H. Seddik 7

Lecture (2) Visual Programming (C#) Modifying Form Properties using Events (Contd. ) So, all

Lecture (2) Visual Programming (C#) Modifying Form Properties using Events (Contd. ) So, all the properties discussed before can be changed internally by using the events (using your code) this. property = ……. A. H. Seddik 8

Lecture (2) Visual Programming (C#) Check Your Knowledge Use the Key. Press event to

Lecture (2) Visual Programming (C#) Check Your Knowledge Use the Key. Press event to hide the control box of the form. Answer : 1 - double click on the event Key. Press 2 - this. Control. Box=false; A. H. Seddik 9

Computer Science (2) Buttons A. H. Seddik 10

Computer Science (2) Buttons A. H. Seddik 10

Lecture (2) Visual Programming (C#) Buttons Click on the Button in the toolbox Click

Lecture (2) Visual Programming (C#) Buttons Click on the Button in the toolbox Click on the form and drag to set the button size Release the mouse button. A. H. Seddik 11

Lecture (2) Visual Programming (C#) Buttons (Move and Resize)) Move the button by clicking

Lecture (2) Visual Programming (C#) Buttons (Move and Resize)) Move the button by clicking on it and drag it to the new location Resize the button from the corners A. H. Seddik 12

Computer Science Button Properties A. H. Seddik 13

Computer Science Button Properties A. H. Seddik 13

Lecture (2) Visual Programming (C#) Buttons Properties Old Properties New properties A. H. Seddik

Lecture (2) Visual Programming (C#) Buttons Properties Old Properties New properties A. H. Seddik 14

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Flat. Style: the Appereance of

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Flat. Style: the Appereance of the control (Button) when the mouse moves over it A. H. Seddik 15

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Image: the image that will

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Image: the image that will be displayed on the control (Button) A. H. Seddik 16

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Image. Align: the Alignment of

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Image. Align: the Alignment of the image on the control (Button) A. H. Seddik 17

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Text. Align: the alignment of

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Text. Align: the alignment of the text on the control A. H. Seddik 18

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Visible: the control is visible

Lecture (2) Visual Programming (C#) Button Properties (Contd. ) Visible: the control is visible or hidden. False A. H. Seddik 19

Computer Science Button Events A. H. Seddik 20

Computer Science Button Events A. H. Seddik 20

Lecture (2) Visual Programming (C#) Button Events Double click on the Button to activate

Lecture (2) Visual Programming (C#) Button Events Double click on the Button to activate the event Button 1_Click (Default Event of the Button) A. H. Seddik 21

Lecture (2) Visual Programming (C#) Button Events (Contd. ) To select another event, double

Lecture (2) Visual Programming (C#) Button Events (Contd. ) To select another event, double click on it (such as form events). A. H. Seddik 22

Lecture (2) Visual Programming (C#) Modifying Properties (form/buttons) using Button Events Example, Change the

Lecture (2) Visual Programming (C#) Modifying Properties (form/buttons) using Button Events Example, Change the text of the form and the color of the button by clicking the button Answer: 1 - Double click on the button to activate the event OR double click on the event from the list A. H. Seddik 23

Lecture (2) Visual Programming (C#) Check Your Knowledge Create the following C# windows application

Lecture (2) Visual Programming (C#) Check Your Knowledge Create the following C# windows application : Red Button: changes the backcolor of the form into Red Hide Blue Green Change Button: All Button: Form Buttons: changes Text: changes Hide changes the all the buttons backcolor the title on ofthe of of the the form into to into “Text Blue Green Changed” A. H. Seddik 24

Computer Science End Of Lecture (2) A. H. Seddik 25

Computer Science End Of Lecture (2) A. H. Seddik 25