CHAPTER 19 BUILDING A BETTER WINDOW WITH (Mac os x web server)

CHAPTER 19 BUILDING A BETTER WINDOW WITH SYSTEM.616 STEM.WINDOWS.FORMS Figure 19-4. Monitoring mouse movement … // Handle the MouseMove event MouseMove += new MouseEventHandler(MainForm_MouseMove); } // MouseMove event handler. public void MainForm_MouseMove(object sender, MouseEventArgs e) { Text = string.Format(”Current Pos: ({0}, {1})”, e.X, e.Y); } } If you now run your program and move the mouse over your Form, you will find the current (x, y) value display on the caption area (see Figure 19-4). Determining Which Mouse Button Was Clicked One thing to be aware of is that the MouseUp (or MouseDown) event is sent whenever any mouse button is clicked. If you wish to determine exactly which button was clicked (such as left, right, or middle), you need to examine the Button property of the MouseEventArgs class. The value of the Button property is constrained by the related MouseButtons enumeration. Assume you have updated your default constructor to handle the MouseUp event as so: public MainWindow() { … // Handle the MouseUp event. MouseUp += new MouseEventHandler(MainForm_MouseUp); } The following MouseUp event handler displays which mouse button was clicked inside a message box: public void MainForm_MouseUp (object sender, MouseEventArgs e) { // Which mouse button was clicked? if(e.Button == MouseButtons.Left) MessageBox.Show(”Left click!”); if(e.Button == MouseButtons.Right)
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply