Here is a fun program which causes the user to chase a button around the screen. The title bar captures the mouse coordinates and the screen colon changes.
Source Code:private void MouseMoveHandler(Object sender,MouseEventArgs e){int i;double d_change;this.Text = "Mouse Move x-Coordinate = " + e.X.ToString() + " y-Coordinate = " + e.Y.ToString() + " " + s_color;if(((e.X >= (b_x-2)) && (e.X <= (b_x + b_x_len))) || ((e.Y >= (b_y-2)) && (e.Y <= (b_y + b_y_len)))){n_amount = n_amount + 1000;if (n_amount > 1000000)n_amount = 1000;sb_text = "click here and will $" + n_amount.ToString();b_x = generateRandomNumber.Next() % (600 - b_x_len);b_y = generateRandomNumber.Next() % (600 - b_y_len);i = generateRandomNumber.Next() % 140;d_change = n_amount % 10000;if (d_change == 0){this.BackColor = color[i];s_color = color[i].ToString();}this.button1.Location = new System.Drawing.Point(b_x, b_y);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(b_x_len, b_y_len);this.button1.TabIndex = 0;this.button1.Text = sb_text;}try{}catch (Exception ex){MessageBox.Show(ex.ToString());}}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: