Form.OnMouseMove : Form « System.Windows.Forms « C# / C Sharp by API






Form.OnMouseMove

    



using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class FormMouseMoveEvent : System.Windows.Forms.Form
{
  private System.ComponentModel.Container components = null;

  public FormMouseMoveEvent()
  {

    this.MouseMove += new MouseEventHandler(OnMouseMove);
    InitializeComponent();
  }

  protected override void Dispose( bool disposing )
  {
    if( disposing )
    {
      if (components != null) 
      {
        components.Dispose();
      }
    }
    base.Dispose( disposing );    
  }

  private void InitializeComponent()
  {
    this.components = new System.ComponentModel.Container();
    this.Size = new System.Drawing.Size(300,300);
    this.Text = "Form1";
  }

  [STAThread]
  static void Main() 
  {
    Application.Run(new FormMouseMoveEvent());
  }

  protected void OnMouseMove(object sender, MouseEventArgs e)
  {
    this.Text = "Current Pos: (" + e.X + ", " + e.Y + ")";
  }

}

   
    
    
    
  








Related examples in the same category

1.new Form()
2.extends Form
3.Form.AcceptButton
4.Form.ActiveForm.Location
5.Form.Activated
6.Form.AddOwnedForm
7.Form.AutoScaleBaseSize
8.Form.AutoScroll
9.Form.AutoScrollMinSize
10.Form.BackColor
11.Form.CancelButton
12.Form.CenterToScreen()
13.Form.ClientRectangle
14.Form.ClientSize
15.Form.Closed
16.Form.Closing
17.Form.ContextMenu
18.Form.ControlBox
19.Form.Controls
20.Form.Cursor
21.Form.DesktopBounds
22.Form.DialogResult
23.Form.DisplayRectangle
24.Form.Dispose
25.Form.FormBorderStyle
26.Form.ForeColor
27.Form.GotFocus
28.Form.Height
29.Form.Hide()
30.Form.Invalidate
31.Form.IsMdiContainer
32.Form.KeyPress
33.Form.KeyPreview
34.Form.KeyUp
35.Form.Load
36.Form.Location
37.Form.MaximizeBox
38.Form.MaximumSize
39.Form.MdiParent
40.Form.MenuComplete
41.Form.Menu
42.Form.MinimizeBox
43.Form.MinimumSize
44.Form.MouseDown
45.Form.MouseLeave(All other events)
46.Form.MouseUp
47.Form.OnDragDrop
48.Form.OnDragOver
49.Form.OnInputLanguageChanged
50.Form.OnKeyDown
51.Form.OnKeyPress
52.Form.OnMouseEnter
53.Form.OnMouseHover
54.Form.OnMouseLeave
55.Form.OnMouseWheel
56.Form.OnPaint(PaintEventArgs e)
57.Form.OnResize
58.Form.Opacity
59.Form.Paint
60.Form.Region
61.Form.Resize
62.Form.ResizeRedraw
63.Form.SetStyle
64.Form.ShowInTaskbar
65.Form.Size
66.Form.Show
67.Form.StartPosition
68.Form.SuspendLayout
69.Form.Text
70.Form.Top
71.Form.TransparencyKey
72.Form.Visible
73.Form.Width
74.Form.WindowState