|
|
Thank you very much, it works great.
I have another question, though:
HOw can I produce an 'undo' programmatically?
|
|
|
|
|
I have tried:
Shape.Application.Undo();
and simply nothing happens.
And:
this.VisioContainerDesign.Window.Application.Undo();
And nothing happens either!
????
|
|
|
|
|
You have to use Visio's Undo Manager to begin and end an undo unit scope. See Chapter 25, Using the Visio Undo Manager in Your Program[^] in the MSDN Library. This is in referene to the OLE automation interfaces exposed by Visio, which is what the .NET interop assemblies (RCWs) wrap. For instance, the ApplicationClass has a BeginUndoScope mentioned in the link above.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It works, but if I move a shape once the event is fired MANY times (ten or more). How can I make this event be caught only once for everytime i move a shape?
I could add a counter, but then I wouldn't be able to distinguish when the event is fired correctly from when it is fired because of this weird behavior of visio sdk, so how can I control this?
This is needed because what I do when the shape moves is a heavy process and this eats up time like crazy.
ANY help would be greatly appreciated!
|
|
|
|
|
You can't prevent it from being fired so many times, but you could use a simple state variable to help performance and determine when the last event was fired over a period of time (using a timer, for example, a common approach to many such problems).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm having problems with another event:
how can I detect a doubleclick on a Shape?
How about a rightclick on a shape?
....
(Any help would be greatly appreciatted)
Thanks a lot
|
|
|
|
|
If these are not Control derivatives, then you have to implement the events yourself from their container. The container would receive these events and you'd have to use the MousePosition static property of a Control (and call PointToClient on that control with the coordinates from MousePosition since those are in screen coordinates). Using the returned Point you need to have a way to figure out which shape was clicked, and then cause it to fire it's own Click or DoubleClick events (which you'd have to implement) using the same timer concept I mentioned before.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Do you know how to obtain a shape's coordinated programmatically????
I can DROP a shape at particular coordinated, but not obtain a shapes coordinates....???
|
|
|
|
|
What I know is all from the object model documentation in MSDN Library. You should try reading it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I got it!
[CODE]
double iDropLocationX = myShape.get_Cells("PinX").get_Result(VisUnitCodes.visInches)+1;
double iDropLocationY = myShape.get_Cells("PinY").get_Result(VisUnitCodes.visInches)-0.5;
[/CODE]
|
|
|
|
|
Got another question, tho'
I am creating a method that receives two shapes and connects them programmatically.
How can I do that?
Is there any visio function that can draw that connection given the two shapes?
|
|
|
|
|
I'm using the methods Shape.SetBegin and Shape.SetEnd. But they don't seem to connect just fine.
|
|
|
|
|
This works:
Cell vsoCellGlueFromBegin = oShapeConnector.get_Cells("BeginX");
Cell vsoCellGlueFromEnd = oShapeConneor.get_Cells("EndX") ;
Cell vsoCellGlueToObject = oShape1.get_Cells("Connections.X");
Cell vsoCellGlueToObject2 = oShape2.get_Cells("Geometry1.X1");
vsoCellGlueFromBegin.GlueTo(vsoCellGlueToObject);
vsoCellGlueFromEnd.GlueTo(vsoCellGlueToObject2);
For whom it may concern.
|
|
|
|
|
This works:
Cell vsoCellGlueFromBegin = oShapeConnector.get_Cells("BeginX");
Cell vsoCellGlueFromEnd = oShapeConneor.get_Cells("EndX") ;
Cell vsoCellGlueToObject = oShape1.get_Cells("Connections.X1");
Cell vsoCellGlueToObject2 = oShape2.get_Cells("Connections.X1");
vsoCellGlueFromBegin.GlueTo(vsoCellGlueToObject);
vsoCellGlueFromEnd.GlueTo(vsoCellGlueToObject2);
For whom it may concern.
|
|
|
|
|
hi
i have problem in matrix determinant in 3d matrix so i want
to know how can i solve this programme of finding the
determinant in 3d matrix
bye
matrix determinant in 3*3d
|
|
|
|
|
|
Are you taking about a 3x3 matrix or a matrix of type 3x3x3? For that later you wuold have to approach the process through the Gram-Schmit Orthonormalization method. A google search reveals various articles on how to work with matrices of three dimensions.
|
|
|
|
|
I have a translation program called .net Framwork1.1. If it's running in .net Framwork 1.1, would there any error ocurr ?
does .net Framwoek is compatibled
study everyday
|
|
|
|
|
Uhhh....You have a what?
I take it you have a program written for the .NET Framework 1.1?
RageInTheMachine9532
|
|
|
|
|
The .NET Framework versions are both forward and backward compatible to a degree. If you use a new method (or whatever) introduced in a new version while running against an older version where that method (or whatever) isn't defined, you'll get an exception like a TypeLoadException . If you use an obsolete/deprecated method in an older framework that no longer exists in the newer framework, you'll get an exception (this is far less common, but still happens).
Read both Deploying Applications[^] and Configuring Applications[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I have a xml-document and i place it in a datagrid with a dataset. One column is named "numbers". When i load the xml-document into the datagrid, the column looks like this 6,3,2,1,5,8 and when i press the column (the header) he arranges them nicely 1,2,3,5,6,8. But when i save the dataset (dataset.WriteXml(filepath)) and load it again nothing has changed, it's back to 6,3,2,1,5,8.
How can i save this?
thx in advance
|
|
|
|
|
The view of the data is changed, not the actual data (in reference to DataSet s and DataTable s, the DataView is what's changed).
If you need to sort your data, then you can use XPath navigation or XSLT transforms which makes sorting easy work.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
if i use the Xpath navigation, i should use XPathNavigator to select the nodes and XPathNodeIterator to walk through them? How do i move a node then?
|
|
|
|
|
Write them out as you iterate through them.
Personally, I'd use XSLT. You can easily write a template section that handles everything else and outputs it as-is while sorting the data you want using the sort element inside an apply-templates element. It certainly be a heck of a lot easier and would de-couple your code from sorting the XML data so that you could always transform it differently later by changing the XSLT document.
Microsoft MVP, Visual C#
My Articles
|
|
|
|