简体   繁体   中英

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 size 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM