Windows光标最大尺寸
我有一个大小为 128x128 的光标,但是当我使用 LoadCursor 加载并显示它时,它只有 32x32。哪个API可以正确实现? MS 似乎调整了它的大小。谢谢。
I have a cursor what the size size 128x128, but when i used LoadCursor to load and show it, it only has 32x32. Which API can make it correctly? It seems MS resize it. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Windows XP 不包含任何大于 32x32 的系统光标。 (如果包含较大的光标,则当标准 API 加载光标时,它们将被拉伸至 32x32。)
对于高 DPI 系统,Windows XP 已将 SM_CXCURSOR 和 SM_CYCURSOR 值调整为 64x64 像素。这种大小调整是为了防止鼠标指针因太小而无法有效使用而实际上消失。尽管系统的其他方面随 DPI 缩放,但鼠标指针不缩放。 Microsoft 不会尝试强制鼠标指针的大小与 DPI 无关。
系统还提供了SetSystemCursor API函数,您可以使用该函数来更改特定类别的系统光标。您可以使用此功能设置任意大小的光标。但是,您必须以编程方式调用该函数,并且只能使用它为特定类别设置光标。您不能使用它使系统上的所有光标具有相同的大小。
http://support.microsoft.com/kb/307213
Windows XP does not include any system cursors that are larger than 32x32. (If larger cursors were included, they would be stretched down to 32x32 when the standard APIs load the cursors.)
For high-DPI systems, Windows XP has adjusted the SM_CXCURSOR and SM_CYCURSOR values to be 64x64 pixels. This size adjustment is to prevent the mouse pointer from virtually disappearing because it is too small to be effectively used. Although the other aspects of the system scale with DPI, the mouse pointer does not scale. Microsoft does not try to enforce a DPI-independent size for the mouse pointer.
The system also provides the SetSystemCursor API function that you can use to change the system cursor for specific categories. You can use this function to set a cursor of any size. However, you must call the function programmatically, and you can only use it to set a cursor for a specific category. You cannot use it to make all cursors on the system the same size.
http://support.microsoft.com/kb/307213
不要使用 LoadCursor,而是使用 LoadImage()。
Don't use LoadCursor, use LoadImage() instead.
SM_CXCURSOR
bySM_CYCURSOR
是系统当前可以使用的唯一光标大小。使用 GetSystemMetrics 找出这些值。
SM_CXCURSOR
bySM_CYCURSOR
is the only cursor size the system can currently use.Use
GetSystemMetrics
to find out those values.