Results 1 to 3 of 3

Thread: How to make a Dropshadow?

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    How to make a Dropshadow?

    How can you make a proper dropshadow for an image? I just used a gradientbrush and filled another rectangle but that doesn't look nearly as good.

    VB Code:
    1. Public Function DropShadow(ByVal img As Image, ByVal OffSet As Integer) As Bitmap
    2.         Dim g As Graphics
    3.         Dim bmp As New Bitmap(CType(img.Width, Integer), CType(img.Height, Integer))
    4.         g = Graphics.FromImage(bmp)
    5.         Dim gb As New Drawing2D.LinearGradientBrush(New RectangleF(OffSet, OffSet, img.Width, img.Height), Color.Black, Color.White, Drawing2D.LinearGradientMode.ForwardDiagonal)
    6.         g.FillRectangle(gb, New Rectangle(OffSet, OffSet, img.Width, img.Height))
    7.         g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width + OffSet, img.Height + OffSet, GraphicsUnit.Pixel)
    8.         Return bmp
    9.     End Function

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Never done one before...

    but maybe you can get better results using a PathGradientBrush...

    VB Code:
    1. Dim cBrush As New PathGradientBrush(myPath)
    2. Dim colors() As Color = {Color.GoldenRod}
    3.  
    4. cBrush.CenterColor = Color.Yellow
    5. cBrush.SurroundColors = colors
    6.  
    7. Graphics.FillPath(cbrush,mypath)

  3. #3

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I haven't used Paths yet so I'll have to check them out. Thanks for the suggestion. For now I used three small rectangles but it still doesn't look that good.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width