11

If you look at the thumbnail images in Windows Explorer you'll notice that they have a drop shadow, is this effect associated with the ListView control or does Windows Explorer does some extra coding to accomplish this effect?


Edit:

So it turned out that Windows uses another control. So my question now is how can I add a drop shadow to the "normal" ListView.

  • Explorer doesn't use the system list view control – David Heffernan Nov 29 '14 at 16:54
  • Does it use a control that we don't have access to? –  Nov 29 '14 at 17:14
  • 1
    Yes indeed it does: http://stackoverflow.com/questions/4089196/netuihwnd-and-directuihwnd – David Heffernan Nov 29 '14 at 17:16
  • That's compilcated... You could well enough end up making a semi-transparent bitmap and blurring it just to make a shadow... –  May 09 '15 at 12:57
  • @Mints97 How is it complicated, I mean what should I learn in order to be able to do it. I have an idea, which is to draw the drop shadow on the image itself, I have tried this and it worked great, however there is a problem: When I select the ListView item then the drop shadow is also shown selected! So is there a way to only let a part of the ListView item to be shown selected (the part which does not have the drop shadow)? –  May 10 '15 at 02:21
  • I'm running Windows 10 and there aren't any drop shadows for the thumbnail images. Could you add a screenshot to your question to describe the effect you are after? – IInspectable Dec 14 '15 at 21:47

2 Answers2

1

For a standard list view, you may want to use a technique called custom draw (https://msdn.microsoft.com/en-us/library/windows/desktop/ff919569(v=vs.85).aspx).

Basically, you ask your list view not to draw its items, but instead send you some window messages for you to draw them yourself. This is a very flexible but also troublesome technique, because you need to handle many things (like whether an item is selected/disabled, font, color etc.)

Alan Tsui
  • 31
  • 2
0

The drop shadow you see in Windows Explorer is not publicly available for you to use. So you will have to custom-draw the items (NM_CUSTOMDRAW) by yourself.

Not sure if such effect is available in GDI/GDI+, but Direct2D does have one: https://learn.microsoft.com/en-us/windows/win32/direct2d/drop-shadow

Huan Xia
  • 11
  • 3