如果我使用此代码,我的面板(画布)会崩溃:
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream resStream = asm.GetManifestResourceStream("Pie_X.blank.cur"))
{
CanvasCursor = new Cursor(resStream);
resStream.Close();
}
using (Stream resStream = asm.GetManifestResourceStream("Pie_X.hand.cur"))
{
HandCursor = new Cursor(resStream);
resStream.Close();
}
这段代码如何不会导致它崩溃:
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream resStream = asm.GetManifestResourceStream("Pie_X.blank.cur"))
{
CanvasCursor = new Cursor(resStream);
resStream.Close();
}
using (Stream resStream = asm.GetManifestResourceStream("Pie_X.blank.cur"))
{
HandCursor = new Cursor(resStream);
resStream.Close();
}
blank.cur 是我从网上下载的光标,hand.cur 是我在 photoshop 中使用光标插件制作的光标。为什么我的光标无法加载,我尝试将大小减小到 30x30 像素,但它仍然崩溃。