Results 1 to 8 of 8

Thread: [RESOLVED] System.Windows.Media... AreaGradient ?

Threaded View

  1. #7
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: System.Windows.Media... AreaGradient ?

    You could make something a bit like that in WPF just by blurring a rectangle.
    Code:
         Dim r As New Rectangle With {.Width = 250, .Height = 250, .Fill = Brushes.Red}
         r.Effect = New Effects.BlurEffect With {.Radius = 25, .RenderingBias = Effects.RenderingBias.Quality}
         Dim vb As New VisualBrush With {.Stretch = Stretch.None, .Visual = r}
        'use a Canvas or other control to display the resulting brush:
        Canvas1.Background = vb
    result:
    Name:  blurredSquare.jpg
Views: 537
Size:  25.5 KB

    Admittedly, this lacks the pointy corners of your post #3 image. If those features are wanted, you could piece the triangles together using a DrawingContext, which is the WPF equivalent of a System.Drawing.Graphics object, as you did in GDI+. I don't have time now to work out the actual drawing code required now, but this should give you a rough idea of how to create the brush:
    Code:
        Dim dv As New DrawingVisual
          Dim dc As DrawingContext = dv.RenderOpen
          'insert drawing instructions here
          dc.Close()
        Dim vb As New VisualBrush With {.Stretch = Stretch.None, .Visual = dv}
    BB

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