2
我想加载一个本地图像并将其用于光标。为了做到这一点,我必须从图像发送一个流到游标(Stream cursorStream)的构造函数。如何使用wpf中的本地图像更改光标?
var res = Application.GetResourceStream(new Uri("pack://application:,,,/MyProj;component/Images/delete-icon.png"));
this.Cursor = new Cursor(res.Stream);
的问题是,我总是得到这个异常
ReadTimeout = (res.Stream).ReadTimeout threw an exception of type 'System.InvalidOperationException'
WriteTimeout = (res.Stream).WriteTimeout threw an exception of type 'System.InvalidOperationException'
我应该怎么办呢?
可能重复到:http://stackoverflow.com/questions/46805/custom-cursor-in-wpf – 2012-03-02 09:25:09
全部工作示例CA在这里找到:http://stackoverflow.com/questions/2835502/旋转光标-根据对旋转-文本/ 2836904#2836904 – 2012-03-02 09:26:03