Is it possible to create a simple drop shadow using GDI+ Blur?

loop123123 1 Reputation point
2020-08-14T12:58:13.477+00:00

I'm displaying bitmaps, and I'd like to add a simple drop shadow to them (like the way Explorer does in the preview pane). I figured out how to do it with Direct2D, but that was sort of overkill, so I was wondering if there's a simpler way to do it using GDI+. I'm very new to graphics.

GDI+ has a Blur class. I was wondering if that could be used on a plain gray bitmap, and then offset from the original image to create a shadow. Does anyone know if that would work? I can't seem to find any examples of drop shadows using that Blur class.

Thanks for any input.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,438 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 81,861 Reputation points
    2020-08-14T14:47:56.61+00:00

    A simple way is with DropShadowEffect Class

    A test in C++ (/clr) with color (169, 169, 169) and ShadowDepth = 15 =>

    Hulk-shadow.jpg