|
-
Dec 12th, 2003, 01:42 AM
#1
Thread Starter
Frenzied Member
Regions, Ellipses and Intersect Problem (maybe a bug?)
Intersect method of a Region means to update the region data with its intersection with another Region, GraphicsPath, Rectangle, or RectangleF. If the second object is totally inside the region then its intersect bounds shoud be exactly the same as the object itself (at least thats what I think). But this is not true with ellipses and regions, as the Y of the intersect region is 1 more than the Y of the ellipse and its height is one less, but X and Width are the same. That does not happen for Rectanlges. Try the following codes to see what I mean.
VB Code:
Dim gPath As New Drawing.Drawing2D.GraphicsPath
gPath.AddEllipse(New RectangleF(3, 3, 10, 10))
Dim rg As New Region(New RectangleF(0, 0, 20, 20))
rg.Intersect(gPath)
MessageBox.Show(rg.GetBounds(Me.CreateGraphics).Equals(gPath.GetBounds))
Returns False
VB Code:
Dim gPath As New Drawing.Drawing2D.GraphicsPath
gPath.AddRectangle(New RectangleF(3, 3, 10, 10))
Dim rg As New Region(New RectangleF(0, 0, 20, 20))
rg.Intersect(gPath)
MessageBox.Show(rg.GetBounds(Me.CreateGraphics).Equals(gPath.GetBounds))
Returns True
VB Code:
Dim gPath As New Drawing.Drawing2D.GraphicsPath
gPath.AddEllipse(New RectangleF(3, 3, 10, 10))
Dim rec As New RectangleF(0, 0, 20, 20)
MessageBox.Show(RectangleF.Intersect(rec, gPath.GetBounds).Equals(gPath.GetBounds))
Returns True
VB Code:
Dim gPath As New Drawing.Drawing2D.GraphicsPath
gPath.AddRectangle(New RectangleF(3, 3, 10, 10))
Dim rec As New RectangleF(0, 0, 20, 20)
MessageBox.Show(RectangleF.Intersect(rec, gPath.GetBounds).Equals(gPath.GetBounds))
Returns True
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 23rd, 2003, 05:31 AM
#2
Thread Starter
Frenzied Member
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Jun 21st, 2004, 02:12 PM
#3
Lively Member
Hmm you sure seem to have studied the problem...
I have stumbled over this issue too. i used addarc (x 4, 1 for each corner) to create a path the shape of a rectangle with rounded corners. i filled my path and then i used drawpath method to draw an outline. my problem is that when i use this path as region for my control the outline is clipped especially in the corners area. have you found any workaround for getting the exact intersection ?
-
Jun 24th, 2004, 08:09 PM
#4
Thread Starter
Frenzied Member
Well, I still think that is a bug. I posted the question to MSDN newsgroup and didn't get anything back and now that I am checking the messages there, it seems they only keep messages of last three months or so and my message was not there at all.
for your problem, try using Widen method of Graphicspath and see if that corrects your problem, becuase I guess the outline is not considered inside the graphicspath, you know what I mean?
Last edited by Lunatic3; Jun 25th, 2004 at 09:52 AM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Jun 25th, 2004, 06:47 AM
#5
PowerPoster
Hi,
I don't really have a clue as to what you guys are talking about, but I do work with elipses. I have to calculate the voulme of liquid remaining in eliptical tanks, which necessitates calculating the area of an elipse lying below a given horizontal line. If that formula is of any use to you I can post it.
You might find your question answered in
www.mathforum.org/dr.math
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|