using System;
using System.Windows;
using System.Windows.Input;
class MainClass
{
[STAThread]
public static void Main()
{
Application app = new Application();
Window win = new Window();
win.Title = "Handle An Event";
win.MouseDown += WindowOnMouseDown;
app.Run(win);
}
static void WindowOnMouseDown(object sender, MouseButtonEventArgs args)
{
Window win = sender as Window;
string strMessage =args.ChangedButton +":"+ args.GetPosition(win);
MessageBox.Show(strMessage, win.Title);
}
}
|