Time delay rendering complex linestyles

G

Guy..L

If I ask the AxDrawingControl to draw a polyline using a linestyle that has
little arrows on it, my call to Page.DrawPolyline returns quickly but the
drawing surface takes a while to update.

I've noticed that the more complex the arrowheads, the longer the delay
between DrawPolyline returning and actual lines rendering.

However, after several subsequent calls, the delay goes away and arrowed
lines are drawn almost as fast as normal lines. Looking at the performance
of processes, it sure seems that my app is responsible for the delay but not,
I'm guessing, in my code but in the drawing control DLL.

Is there any way to have the control load those linestyles before I call my
first DrawPolyline, so that the delay is not incurred on that first call but
sometime while my app initializes?
 
A

AlEdlund

As 'you might' be observing, the i/o time to read shapes can impact
performance when you have a lot of complex shapes to deal with. Visio's
operation when you 'read' a shape from a master is to first put it into the
document stencil and then drop the copy onto the page. What I do is to
preload the stencils that I will need, and the preload the masters into the
document stencil, something like this
' first check to see if the shape is in the
' document stencil since it can error out, wrap in
try-catch
Dim lclMaster As Visio.Master = Nothing
Try
lclMaster = m_visdoc.Masters(strMaster)
Catch
End Try
If (lclMaster Is Nothing) Then
' load the masters (the stencils were preloaded)
vsoStencil = vsoDocs.Item(strStencil)
vsoMaster = vsoStencil.Masters.Item(strMaster)
' put the master into the document, not the page
lclMaster = m_visdoc.Drop(vsoMaster, 0, 0)
End If

then when I need to drop a shape I check the document stencil first, and if
it is not loaded for some unforseen reason, then get the master from already
loaded stencil.
hth,
al
 
G

Guy..L

The DrawPolyline response is delayed independently of my document stencil and
masters. (Unless you know that styles are actually Masters.)

Here's some approxicode:

Page p;
....
p.Document.DefaultLinestyle = "ComplexArrowheads";
p.DrawPolyline(etc);
p.Document.DefaultLinestyle = "Normal";

The first time this sequence is called produces the longest delay. The
delay exhibits itself by returning from the DrawPolyline and continuing on
the application's thread of instructions while the actual control's drawing
surface is either blank or remains on the old view (prior to the
DrawPolyline). Depending on the complexity of the style, the delay can be
several minutes!!!

If this delay is experienced once, then it seems some internal rendering
buffer has been updated and following iterative passes through the above
sequence exhibit less and less of a delay (asymptotically).

To front load this delay, I postulate that I could use this line style to
draw a simple small or invisible line on a page before the user interface
gets worked up and ready. No?
 

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