How to get the bounding box of the active selection?

  • Thread starter Dieter Sternberg
  • Start date
D

Dieter Sternberg

Hi,

Visio put's a green rectangle with sizing handles around a selection of
multiple shapes.
I need the coordinates (bottem/left)(top/right) of this rectangle in
page coords to check whether the user has clicked a mouse button inside
or outside the selection boundingbox.
A little experimenting shows that the rectangle drawn by visio is
slightly larger then ActiveWindow.Selection.BoundingBox depending on
zoomlevel.
But the major problem is, that I can't get Selection.BoundingBox to work
if the selection contains subselected shapes of a group.
Selection.BoundingBox returns only the bounding box of the shapes that
are directly on the page.
I've tried nearly every combination of the flags. Selection.BoundingBox
even doesn't care about the IterationMode. The Selection.Count is shown
correct when applying visSelModeSkipSuper, but the subselected shapes
are not included in the bounding box.
Is this a bug or do I miss some secret?
How can I get the bounding box of a selection containing subselected shapes?

Regards
Dieter
 
P

Paul Herber

Hi,

Visio put's a green rectangle with sizing handles around a selection of
multiple shapes.
I need the coordinates (bottem/left)(top/right) of this rectangle in
page coords to check whether the user has clicked a mouse button inside
or outside the selection boundingbox.
A little experimenting shows that the rectangle drawn by visio is
slightly larger then ActiveWindow.Selection.BoundingBox depending on
zoomlevel.
But the major problem is, that I can't get Selection.BoundingBox to work
if the selection contains subselected shapes of a group.
Selection.BoundingBox returns only the bounding box of the shapes that
are directly on the page.
I've tried nearly every combination of the flags. Selection.BoundingBox
even doesn't care about the IterationMode. The Selection.Count is shown
correct when applying visSelModeSkipSuper, but the subselected shapes
are not included in the bounding box.
Is this a bug or do I miss some secret?
How can I get the bounding box of a selection containing subselected shapes?

Hi Deiter, it looks to me like the box is a consistent 30 pixels
larger than the bounding box size on each side.
 
J

JuneTheSecond

Dieter ,

It may be a bug. I've same experience like you.
And then I used DrawRegion, though it must be deleted after.
 
C

Chris Roth [Visio MVP]

Hi Dieter,

I have an article that explains a bit more detail about the confusing
selection modes:

http://www.visguy.com/2008/05/17/detect-sub-selected-shapes-programmatically/

It's not a direct solution to your problem, but it might help.

I wonder if you'll have to create several bounding-box sets, then union
them together to get the final result?

--
Hope this helps,

Chris Roth
Visio MVP


Visio Guy: Smart Graphics for Visual People

Articles: http://www.visguy.com
Shapes: http://www.visguy.com/shapes
Dev: http://www.visguy.com/category/development/
Forum: http://www.viguy.com/vgforum
 
D

Dieter Sternberg

Thanks for your comments and suggestions,

for now I'am iterating through the selection building the bounding box
myself.
This has the least performance impact. DrawRegion (as June suggested) is
smart, but the performance on large wire diagrams (500+ shapes) was
critical.
However I'am sure this is a bug and therefore have submitted a bugreport
to MS.
Just wanna see what those guys are thinking about this issue.

Regards
Dieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top