vba - Hit-Testing and Resolving Occlusion of AutoShapes in Excel -


i using code draw number of autoshapes in excel based on user input using vba. however, of these shapes may occlude each other, run second pass hit-test shapes occlude , nudge them until no longer occlude.

so basic pseudocode outline be:

do     foreach shape s in shapes         if (s.hittest(shapes))                             s.nudgeup(1)             until (!s.hittest(shapes))         endif     next until (!shapes.hittest(shapes)) 

can of think of way of doing (or working around doesn't have done)?

i've taken @ rangefrom function, doesn't seem use (only returns one shape @ specific screen coordinate, not intersecting shapes).

many help.

you below:

sub moveshapes()     dim wb workbook     set wb = activeworkbook     dim sh worksheet     set sh = wb.activesheet     dim s1 shape     dim s2 shape      = 1 sh.shapes.count         if < sh.shapes.count             set s1 = sh.shapes(i)             set s2 = sh.shapes(i + 1)             if s2.left < (s1.left + s1.width)                 s2.left = (s1.left + s1.width + 1)             end if         end if     next end sub 

this code need more work account top/bottom , multiple overlaps, should enough start.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -