在WPF中也是通过模拟CTRL+Z和CTRL+Y就行
但是在wpf无法使用sendkeys,我帮你在网上找到的一个教程,
https://www.cnblogs.com/sixty/archive/2009/08/09/1542210.html
里面的http://files.cnblogs.com/zhouyinhui/Simulation.zip
封装好了模拟按键的类,如下调用即可模拟CTRL+Z撤销和CTRL+Y重做
private void Button_Click(object sender, RoutedEventArgs e) { spread1.Focus(); Keyboard.Press(Key.LeftCtrl); Keyboard.Press(Key.Z); Keyboard.Release(Key.Z); Keyboard.Release(Key.LeftCtrl); } private void Button_Click_1(object sender, RoutedEventArgs e) { spread1.Focus(); Keyboard.Press(Key.LeftCtrl); Keyboard.Press(Key.Y); Keyboard.Release(Key.Y); Keyboard.Release(Key.LeftCtrl); }