Seeing While You Drag
Published Aug 26 2018 03:14 AM 473 Views
Brass Contributor

First published on MSDN on Sep, 05 2006

There have been several recent newsgroup questions relating to dragging shapes around on the page.  Sometimes you get to see the geometry you are dragging around.  Other times you only see an outline rectangle.  A similar issue is that dragging is quite choppy such that you often don't see what you drag.  Both issues deal with performance in Visio.  Let's look at each one.





Drag image generation



When you drag a shape around, Visio generates a drag image to display.  This is basically a bitmap representation of your shape.  Seeing the actual geometry of your shape helps with positioning and alignment.  If you select a bunch of shapes to drag around, the drag image that Visio must generate is more complex.  This takes more time, which then makes Visio feel sluggish.






To avoid this situation, Visio has a cut-off point of 25 shapes.  This 25 shape limit includes any sub-shapes of groups in the selection.  If you drag around more than 25 shapes at a time, Visio will only show an outline rectangle for the drag image.  You can still pause while dragging, and Visio will go ahead and generate the full image.


An interesting side effect of this threshold is that it causes 2-D glue operations to fail as well.  (2-D glue means gluing a 2-D shape to another 2-D shape, while 1-D glue is the normal connector to 2-D shape operation.)  2-D glue only works when the drag image is shown.  Even pausing to generate the drag image does not work around the problem.  Shapes that have outward connection points on them thus need to be kept simple.




For those that would like to eliminate this threshold entirely, there is a registry key. For Visio 2003 set ‘HKCUSoftwareMicrosoftOffice11.0VisioApplicationDragBitmap’ to “2”. For Visio 2007 set ‘HKCUSoftwareMicrosoftOffice12.0VisioApplicationDragBitmap’ to “2”.  The downside is that you will encounter degraded performance as you begin to drag more complex shapes around.  This may or may not be noticeable on your computer.




Dragging performance



Once you begin dragging and the drag image has been generated, a second issue affects whether you can drag it around smoothly.  Visio must update the rendered drawing as you drag this image across it.  This involves creating a mask out of the drag image and then doing XOR operations against pixels as things move around.  Depending on how complicated the drawing page is behind the drag image, this process can take some time.  The longer it takes to re-render, the choppier the drag behavior appears to be in Visio.  With some really complicated drawings like inserted CAD objects, it may take more than a second for any update to occur.






Dragging performance really depends on the computer's video card, but many users have reported that dragging is actually slower on their new computers versus their older computers.  How can performance be worse on a faster video card?  It turns out that Visio's masking code is really old.  The code makes specific calls to the video card that are no longer in use today.  The cards now support much more efficient ways of doing things.  In fact, video card manufacturers likely no longer optimize the legacy calls.  Since Visio still does things the old-fashioned way, performance goes down on the newer cards.






There is nothing a user can do to address this second problem.  The good news is that Visio 2007 has replaced it's old masking code with newer, mainstream calls to the video cards.  The results are dramatic.  We measured drag performance to be 150 times faster in Visio 2007!  This results in very smooth dragging for even the most complex Visio diagrams.









Keep in mind that both of the two drag issues here impact what you see on the screen.  One is a hard-coded limit based on shape count.  The other is dependent on the performance of the video card (when used with legacy calls).  If the first issue is annoying, you can use the registry fix.  If the second issue is frustrating, you will need to wait for Visio 2007.





Version history
Last update:
‎Nov 08 2021 04:56 PM
Updated by: