CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    101

    Drawing and Clipping

    I have a collection of objects that hold info for drawing an ellipses. They represent various range bands from a central point so there is a single point that have several rings around them. For simplicity lets just say there is a minimum range and a maximum range ring. I want to fill the area between the min. range and max range but nothing inside the min. range. How do I go about doing this? I've tried so many things today and was unable to get it to work. Here's my Paint event that does the drawing of the ellipses which come out nicely:

    Code:
    Private Sub MapView_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
      Dim curRB As RangeBand
      Dim GP As New Drawing2D.GraphicsPath
    
      For Each curRB In RangeBands
        GP.AddEllipse(curRB.pt.x, curRB.pt.y, curRB.Radius * 2, curRB.Radius * 2)
        e.DrawPath(curRB.Pen, GP)
      Next
    
    End Sub
    So basically there's a circle inside a circle and i want to fill the area between the two circles. I've tried so many combinations of regions and clipping settings and just couldn't get it to work right, was driving me crazy.

    - Tom

  2. #2
    Join Date
    Nov 2003
    Posts
    101

    Re: Drawing and Clipping

    Made a simple test program this morning in 10min. and I think I got it figured out now... amazing what leaving a situation and coming back to it at a later time can do for you.

    - Tom

  3. #3
    Join Date
    Dec 2002
    Posts
    305

    Re: Drawing and Clipping

    Easiest thing to do is to start with the outermost ellipse, fill it with the right color, then the next inner ellipse and fill that with opaque color. The fill will cover the first circle except the annular region between the two circles. Proceed in this manner to the innermost circle. Good luck.

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

Featured