Workshop
This workshop will help reinforce the concepts covered in today's lesson. It is very helpful to understand fully the answers before moving on. Answers can be found in Appendix A.
Quiz
Questions 13 refer to the following code snippet:
1: using System; 2: using System.Windows.Forms; 3: using System.Drawing; 4: 5: public class MyForm : Form { 6: private Label lblMessage = new Label(); 7: 8: public MyForm() { 9: this.Text = "Hello World!"; 10: } 11: } 12: 13: public class StartForm { 14: public static void Main() { 15: Application.Run(new MyForm()); 16: } 17: }
-
What would the following statement return if placed after line 9?
-
What would the following code return if placed after line 9?
Label lblTemp = new Label();
Console.Write(lblTemp.Equals(this.lblMessage).ToString());
-
What would the following code return if placed after line 9?
Label lblTemp = new Label();
- True or false: The KeyPress event takes a handler of type KeyEventHandler.
- What are the five properties of the MouseEventArg object?
-
Write a single statement in VB.NET that will set the width of a form to 1/3 of the height of the screen.
-
What property controls which button will be activated when the user presses the Escape key?
-
What is the default FormBorderStyle?
-
Which three events use the two-event for a single action paradigm?
Console.Write(this.ToString());
Console.Write(Object.ReferenceEquals(lblTemp, this.lblMessage).ToString());
Exercises
-
Build an application, in C#, that monitors all six of the mouse events. Display a message in a label when each of the events occurs.
-
Build an application in VB.NET that allows users to customize the Text, Height, Width, and Opacity properties by entering values in a TextBox, and pressing a Submit Button.