|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
containment of a rectangle in an irregular regionI've Googled this but come up short... I have a non-rectangular region that
contains a moveable rectangle. I want to restrict the rectangle's movement to have it always fully contained in this region. Would seem pretty simple to do this with a region's IsVisible function, but no, IsVisible returns true if any portion of the rectangle is visible. I know I'll eventually get this just by messing around but don't want to unnecesssarily re-invent the wheel... is there something built into the Framework that I can use? Paul Sometimes I think I post just because Murphy's Law dictates that I must then
find the solution myself sortly thereafter... Private Function DoesPathFullyContain( _ ByVal p As GraphicsPath, ByVal rect As Rectangle) As Boolean Dim ret As Boolean Dim r1 As New Region(p) Dim r2 As New Region r2.MakeInfinite() r2.Exclude(r1) ret = Not r2.IsVisible(rect) Return ret End Function Show quoteHide quote "PJ6" <nob***@nowhere.net> wrote in message news:Oj1DYXrIGHA.1388@TK2MSFTNGP11.phx.gbl... > I've Googled this but come up short... I have a non-rectangular region > that contains a moveable rectangle. I want to restrict the rectangle's > movement to have it always fully contained in this region. Would seem > pretty simple to do this with a region's IsVisible function, but no, > IsVisible returns true if any portion of the rectangle is visible. > > I know I'll eventually get this just by messing around but don't want to > unnecesssarily re-invent the wheel... is there something built into the > Framework that I can use? > > Paul >
what collection obj can hold 3 parameters per index?
C# to VB.net conversion for "?" conditionals ANN: Free PDF books for registered users of Visual Studio 2005 Cascading list boxes currency manager Waiting for a shell command What am I missing?? Column names in Dataset Creating a dynamic array in VB NET Static linking to unmanaged library |
|||||||||||||||||||||||