| Upravte jsi tento příklad dle potřeby:   
<Window x:Class="MouseSimulation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
    <Grid>
        <Button Content="Click" Height="100" Click="Button_Click" PreviewMouseMove="Button_PreviewMouseMove"></Button>
    </Grid>
</Window>
using System;
using System.Windows;
using System.Runtime.InteropServices;
namespace MouseSimulation
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
        private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
        [DllImport("user32.dll")]
        private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, uint dwExtraInf);
        System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
        public MainWindow()
        {
            InitializeComponent();
            timer.Interval = 10;
            timer.Tick += new EventHandler(MoveNow);
            timer.Start();
        }
        void MoveNow(object sender, EventArgs e)
        {
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X + 1, System.Windows.Forms.Cursor.Position.Y + 1);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.MessageBox.Show("Click");
        }
        private void Button_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            timer.Stop();
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//make left button down
            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//make left button up        
        }
    }
}
 |