Odd behavior

H

ha1o

Hi, I want to ask about some behavior i still cannot explain.

I am developing a winForms application in .NET 2005 and I am using the Visio
SDK.

This is the situation, when I run the application, sometimes the application
shows a message box with a number. for example, when I double-click a shape
to change the text, and I press espace to cancel the new text, then the
application shows the message box with the number 27. It looks like the
application shows the ASCII of the key, but I want to prevent behavior and I
don't know how.

And another thing, when I have a drawing with twenty shapes or so, my
application becomes really slow. to change a shape text it with a word of
four characters it takes like thirty seconds. But if I open Visio and add
twenty shapes, it works just fine. I want to know it there is a way to get my
application work more efficient than now.

And thanks for all the help.
 
J

JuneTheSecond

Something might be wrong, but i cannot see. Would you please give us more
speciphic information.
 
H

ha1o

Hi, here is more info

I create an .NET 2005 C# application. In the main Form, I put and object of
"AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl", the object name is
"drawingControl". When the application starts, I bind a method I created to
an event of the drawingcontrol, this is the instruction:
"((Page)this.drawingControl.Window.PageAsObj).Application.MarkerEvent += new
Microsoft.Office.Interop.Visio.EApplication_MarkerEventEventHandler(Demo);"

Here is the Demo method signature:
"private void Demo(Microsoft.Office.Interop.Visio.Application
theApplication, int sequenceNumber, string context)"

Then I open some stencil files with this instructions:
"Documents targetDocuments =
(Documents)drawingControl.Window.Application.Documents;

targetDocuments.OpenEx(System.Windows.Forms.Application.StartupPath +
@"\CLRStakingSheet.vss", (short)VisOpenSaveArgs.visOpenRO +
(short)VisOpenSaveArgs.visOpenDocked);

targetDocuments["CLRStakingSheet.vss"].BeforeDocumentClose += new
EDocument_BeforeDocumentCloseEventHandler(this.OnStencilClose);
targetDocuments["CLRStakingSheet.vss"].Title = "General";"

After that, I start to drop shapes by code and connecting them with
instructions like this:
"Master masterObj = stencilDocument.Masters.get_ItemU(rw["GraphShapeID"]);

shape shapeObj =
targetPage.Drop(masterObj, this.shapePos.initialLocationX,
this.shapePos.initialLocationY);
shapeObj.Text = "New Shape";

Microsoft.Office.Interop.Visio.Shape connector =
visioApplication.ActivePage.Drop(
shapeObj, 0, 0);

Microsoft.Office.Interop.Visio.Cell beginX = connector.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXForm1D,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.vis1DBeginX);

beginX.GlueTo(shapeObj.get_CellsSRC(
(short)Microsoft.Office.Interop.Visio.
VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.
VisRowIndices.visRowXFormOut,
(short)Microsoft.Office.Interop.Visio.
VisCellIndices.visXFormPinX));
"

Basically, this is all I do with the drawingControl object. The user can see
the stencil files opened and he can add new shapes manually to the
drawingControl. The problem is when the user add around twenty shapes, the
application becomes really slow. when the user wants to change the text of
any shape it takes like five seconds to shows a letter. so if you write then
letter on the keyBoard, the application takes like a minute to write the
whole word. And I don't have idea where to look to fix that.

Thanks again for the help
 
H

ha1o

Could be possible that change some data on the stencil files that contains
the shapes for the application may affect the application performance?
 
P

Paul Herber

Could be possible that change some data on the stencil files that contains
the shapes for the application may affect the application performance?

Hard to say without seeing exactly what you are doing. Very
complicated shapes i.e. very large grouped shapes or shapes containing
large images may slow things down. However, I've just done a test on 1
GHz 256MB system running Visio 2003 and adding a large number of the
graph shape starts slowing down when you get several hundred of the
same shape, using Edit -> Duplicate repeatedly.
I use Delphi for my applications and even with automated drawings from
scripts creating drawings with several hundred shapes on a page
together with connectors it all works in seconds.
 
H

ha1o

Hi Paul

I create a new application, just with the visio control, and I even paste
the shapes in the sample that the Visio SDK creates when installed(the one
named "Office Plan"). Change the shape's text is slow in both applications
with twenty shapes.

I now believe that may be the installation or the library I'm using, is the
responsible for the problem.

I am using:
-Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
-Microsoft .NET Framework Version 2.0.50727
-Micorsot Office Visio Professional 2003 SP2(11.5509.6568)
-Library AxInterop.VisOcx.dll Version 11.0.0.0

can you do me the favor to compare your versions and let me know if there is
any difference with mine?

thanks for all the help
 
M

Mark Nelson [MS]

What kind of shapes are these? Can you reproduce the problem using plain
rectangles (use DrawRectangle instead of Drop to add shapes)? Does your
application handle any Visio events?

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
H

ha1o

Hi Mark

I did what you said. Here is what happed, when dropped 25 rectangles the
applicationc worked fine; I even drop 500 rectangles and tha application
didn't slow a bit the performance.

I am using a event named "ShapeAdded". I use this event to know when the
user adds a new shape and set new action rows.

About the shapes, I am using shapes like "Hub", "Patch Panel", "City",
"Dynamic Connector", and others. I create three custome properties and create
an action that calls the properties window for the shapes that didn't had it,
and I also create connectors points for the "Hub" shape because it didn't
have those points. that's what I did, is there some data that can slow the
performance on the stencil's shapes?
 
P

Paul Herber

Hi Paul

I create a new application, just with the visio control, and I even paste
the shapes in the sample that the Visio SDK creates when installed(the one
named "Office Plan"). Change the shape's text is slow in both applications
with twenty shapes.

I now believe that may be the installation or the library I'm using, is the
responsible for the problem.

I am using:
-Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
Don't use it
-Microsoft .NET Framework Version 2.0.50727
2.0 something
-Micorsot Office Visio Professional 2003 SP2(11.5509.6568)
2000, 2003, 2007 beta
-Library AxInterop.VisOcx.dll Version 11.0.0.0
don't use it.
 
P

Paul Herber

Hi Mark

I did what you said. Here is what happed, when dropped 25 rectangles the
applicationc worked fine; I even drop 500 rectangles and tha application
didn't slow a bit the performance.

I am using a event named "ShapeAdded". I use this event to know when the
user adds a new shape and set new action rows.

About the shapes, I am using shapes like "Hub", "Patch Panel", "City",
"Dynamic Connector", and others. I create three custome properties and create
an action that calls the properties window for the shapes that didn't had it,
and I also create connectors points for the "Hub" shape because it didn't
have those points. that's what I did, is there some data that can slow the
performance on the stencil's shapes?

taking these shapes and dropping them on a page, selecting them and
duplicating a few times, repeat select them all etc, until you get to
64 - it's a bit like walking in treacle. Probably because these shapes
contain groups of shapes containing images i.e. the patch panel shape
contains 9 shapes, two of those 9 shapes are the blocks of 12 RJ45
connectors. Each of those blocks is a group itself containing 42
shapes.
It's rapidly getting a bit complicated.
 

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