views:

1074

answers:

4

Our app has a very large number of System.Drawing.Bitmaps that are to be displayed with drop shadows. What's a quick way of drawing drop shadows, with a given blur radius and colour? It's a winforms app, no WPF. p/invoke preferred to unsafe code, but ideally neither; third-party libraries not allowed.

I've seen the 'Image Processing for Dummies' tutorial but it uses unsafe code.

+1  A: 

I guess the tutorial using unsafe code you're mentioning uses unsafe code to speed up the convolution used for the blur. You can rewrite that not using unsafe code just as well, it will just be slower.

Joey
A: 

What about doing something like this:

ControlPaint.DrawImageDisabled(g, image, x + 2, y + 2, width, height);
g.DrawImage(image, x, y, width, height);
Eric
+1  A: 

I wrote a vb.net subroutine to draw easly a shadow for a Bitmap object; It is possible to get a charming shadow and You can edit same Shadow's properties like Opacity, Softness, Distance or rounded edges.

Take a look at the code and examples at:

link text

Max

Max
A: 

try this code project

Anand
Thanks, but that just draws a shadow behind top-level forms, not bitmaps.
Simon