Re: GraphicsPath.IsVisible broken?
- From: Gabriela Alonso <farpoint.anywhere@xxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Jul 2006 13:17:26 -0700
I just ran into a similar situation. All you have to do is scale both the GraphicsPath and the point you´re testing by the same proportion.
Following your example:
(sorry if the syntax is not correct. I usually use C#)
Public Sub IsVisibleExample(ByVal e As PaintEventArgs)
Dim myPath As New GraphicsPath
myPath.AddEllipse(0.0, 0.0, 1.0, 1.0)
myPath.Transform(new Matrix(100, 0, 0, 100, 0, 0)) '(1)
Dim visible As Boolean = myPath.IsVisible(0.5 * 100, 0.5 * 100, e.Graphics) '(2)
MessageBox.Show(visible.ToString())
End Sub
(1) Scale by 100 units in both the x and y dimensions. NOTE: If yopu´re planning to use the GraphicsPath again (for drawing it for example) do not scale it, scale a copy instead. The Transform method transforms the object that calls it.
(2) To scale a point just multiply the x and y coordinates by the desired factor.
So, that´s it. The higher the number you use as scale factor the more precise your IsVisible approach will be.
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
.
- Prev by Date: I have an issue with an image getting corrupted upon scroll in a panel.
- Next by Date: Re: I have an issue with an image getting corrupted upon scroll in a panel.
- Previous by thread: I have an issue with an image getting corrupted upon scroll in a panel.
- Next by thread: For Bob Power, please repost the NativeWindowSample here
- Index(es):
Relevant Pages
|
Loading