Get and set Windows desktop icons size in C#
I'd like to get and set the desktop icons sizes in Windows Vista and 7 - now the desktop allows to resize the icons dinamically with Ctrl-MouseWheel and I'd like to do it using C#.
Yes, I can send the WM_MOUSEWHEEL
message to the desktop listview handle, but that has two disadvantages:
- I don't have the current size, so I must send the message many times, until I reach a known state (maximum or minimum size) then send the message again to resize to the desired size
- The above procedure is slow (I must send many messages to reach the desired size, that can't be done in one step) and it sometimes flickers when it reaches the known state.
I'd like to know if there is any way to get the current icon size and set it to another s开发者_高级运维ize programatically
I know you can get the size of the icons fairly easily using the SystemInformation class. It seems there is no setter, so you may have to dig deeper and use the system's SystemParameterInfo()
function. See the SPI_GETICONMETRICS
and SPI_SETICONMETRICS
parameters.
It seems the only way to this is through the registry. See towards the middle of this page ("When in Windows").
Update:
Ok, I see what you are saying now. You need to use the desktop's IFolderView (CurrentViewMode) or IFolderView2 (ViewModeAndIconSize).
精彩评论