display form's current coordinates using ToolTip

Ddd
Posted by Ddd under Windows Forms category on | Points: 40 | Views : 1831
//Drag a tooltip control from the ToolBox. It will be pasted in the Component Tray.
//Write the code in the Form1_MouseMove eventHandler.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//This is the Code.

toolTip1.SetToolTip(this, "X"+"-->"+e.X +"\n"+"Y"+"-->" + e.Y);

}
}
}

Comments or Responses

Login to post response