Determine cursor size of currently selected theme

随声附和 提交于 2019-12-12 03:09:18

问题


I want to show a custom mouse cursor, in a size that matches the current settings (in the control panel) of the user.

Doing Cursor.Current.Size always returns 32x32 (as I guess they always are technically, though not visually), no matter what the control panel settings, which are correctly reflected by smaller or bigger cursor appearances.

So how do I figure out the size?


回答1:


For what I have found out, you have to get the Icon for the cursor (probably with some win32-API) and then using ICONINFO to find out the mask bitmap. After that you can check the pixels of the icon and count until you find the transparent color and that way find out the real size.

I have seen a couple of answers on other sites that point to this direction, but I cant find a complet solution, just fragments here and there..

This stackoverflow question have a good answer about the bitmap masks used by the cursor and from there maybe you can work your way to the solution.

C# - Capturing the Mouse cursor image

This question is old, I have seen this question on other sites from year 2003, so if you have success, then please put the answer here, many would be glad to se the solution to this question.



来源:https://stackoverflow.com/questions/9324892/determine-cursor-size-of-currently-selected-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!