CHAPTER 19 BUILDING A BETTER WINDOW WITH (Web hosting e commerce)
CHAPTER 19 BUILDING A BETTER WINDOW WITH SYSTEM.614 STEM.WINDOWS.FORMS public class MainWindow : Form { protected override void OnMouseDown(MouseEventArgs e) { // Add code for MouseDown event. // Call parent implementation when finished. base.OnMouseDown(e); } } While this can be helpful in some circumstances (especially if you are building a custom control that derives from a standard control; see Chapter 21), you will often handle events using the standard C# event syntax (in fact, this is the default behavior of the Visual Studio 2005 designers). When you do so, the framework will call your custom event handler once the parent s implementation has completed: public class MainWindow : Form { public MainWindow() { MouseDown += new MouseEventHandler(MainWindow_MouseDown); } void MainWindow_MouseDown(object sender, MouseEventArgs e) { // Add code for MouseDown event. } } Beyond these OnXXX() methods, here are a few other methods to be aware of: Hide(): Hides the control and sets the Visible property to false Show(): Shows the control and sets the Visible property to true Invalidate(): Forces the control to redraw itself by sending a Paint event To be sure, the Control class does define additional properties, methods, and events beyond the subset you ve just examined. You should, however, now have a solid understanding regarding the overall functionality of this base class. Let s see it in action. Fun with the Control Class To illustrate the usefulness of some members from the Control class, let s build a new Form that is capable of handling the following events: Respond to the MouseMove and MouseDown events. Capture and process keyboard input via the KeyUp event. To begin, create a new class derived from Form. In the default constructor, you ll make use of various inherited properties to establish the initial look and feel. Note you re now using the System. Drawing namespace to gain access to the Color structure (you ll examine this namespace in detail in the next chapter): using System; using System.Windows.Forms; using System.Drawing;
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.