c# - 自定义光标全黑,无颜色

标签 c# colors

我像这样为我的程序选择自定义 .cur 文件:

Assembly asm = Assembly.GetExecutingAssembly();

using (Stream resStream = asm.GetManifestResourceStream("Pie_X.hand.cur"))
{
  HandCursor = new Cursor(resStream);
  resStream.Close();
}
Canvas.Cursor = HandCursor;

我在资源编辑器中检查过它是全彩色的,但在程序中它显示为全黑。 我该如何解决这个问题,使其显示为彩色?

最佳答案

这是一个老问题,但对于 future 的读者,我想这里已经有了答案:https://stackoverflow.com/a/4306984/7197632

特别是,这个答案的开头段落说:

The Cursor class is rather poorly done. For some mysterious reason it uses a legacy COM interface (IPicture), that interface doesn't support colored and animated cursors.

这可以解释为什么光标显示为全黑或全白。我今天自己遇到了这个问题。

关于c# - 自定义光标全黑,无颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10567603/

相关文章:

html - 使用 Bootstrap (Nav-pills) 在 CSS 中更改文本颜色

c# - 如何模拟静态引用的程序集?

c# - 如何在 C# 应用程序中生成 SSH 2 RSA key ?

Python tkinter窗口背景/ Canvas 不改变颜色

c++ - 对图像中的一系列颜色进行阈值处理

php - 如何更改我的 php 的颜色和字体大小?如果我尝试,它不起作用

c# - 无法转换为特定格式 C#

c# - 什么是 ServiceObjectiveId?

c# - Ping 到存储过程以了解在 .net 中完成的执行?

c# - 为什么当 Alpha==0 时 System.Drawing.Graphics 会消隐 RGB channel ?