Results 1 to 8 of 8

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

Hybrid View

  1. #1
    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: 536
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

  2. #2

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

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

    Quote Originally Posted by boops boops View Post
    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+
    Thanks BB. I'll look into it.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

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