ну, я не знаю, может что-то такое
:
using System;
using System.Windows.Forms;
class MainForm: Form
{
public TextBox Text1;
public MainForm()
{
Button1 Btn = new Button1();
Text1 = new TextBox();
this.Controls.Add(Text1);
this.Controls.Add(Btn);
Btn.Left = 30;
Btn.Top = 30;
Timer tm = new Timer();
tm.Interval = 1000;
tm.Enabled = true;
tm.Tick += new EventHandler(MainForm_Timer);
}
protected void MainForm_Timer(object sender, EventArgs e)
{
this.Text1.Text = Cursor.Position.X.ToString() + ' ' + Cursor.Position.Y.ToString();
}
}
class Button1: Button
{
protected override void OnMouseDown(MouseEventArgs e)
{
MessageBox.Show("Hello");
}
}
class App
{
public static void Main()
{
Application.Run(new MainForm());
}
}