摘要: 获取焦点下的元素,不如最后一个为button按钮,代码如下:1 Button bt = (Button)Keyboard.FocusedElement;现在就可以使用button了,1 MessageBox.Show(bt.Name);问题是需要使用之前点击过的控件,比如一个textbox按钮,需要把这个控件给存下来。可以定义一个全局的数组或是别的类型。1 object[] control = new object[10];2 for (int i = 0; i < 10; i++)3 {4 control[i] = Keyboard.FocusedElement;5 }并且需... 阅读全文
posted @ 2013-05-15 10:16 夜曲984 阅读(631) 评论(0) 推荐(0) 编辑
摘要: 使用C#获取光标相对于显示器屏幕的位置:方式一: 1 [csharp] view plaincopyprint? 2 using System; 3 using System.Drawing; 4 using System.Runtime.InteropServices; 5 6 namespace ColorPicker 7 { 8 /// <summary> 9 /// win8下wpf程序测试成功 10 /// </summary> 11 public class CursorPointManager 12 { ... 阅读全文
posted @ 2013-05-15 08:57 夜曲984 阅读(825) 评论(0) 推荐(0) 编辑