index > Visual Studio Team System - Domain-Specific Language Tools > ZOrder

ZOrder


I am having problems setting the ZORder manually.

...
using (Transaction t = this.Store.TransactionManager.BeginTransaction("Setting ZOrder"))
{
try
{
shape.ZOrder = shapeParent.ZOrder + 1;
t.Commit();
}
catch (Exception xException)
{
t.Rollback();
System.Diagnostics.Debug.WriteLine(xException);
}
}


The code works, but the shape doesn't change the visual arrangement in the diagram.
Is it working?
leovernazza
Hi:
Have you try to invoke invalidate at the end of your change to force a refreshment of the diagram?

shape.Invalidate();
Pedro J. Molina
Yes, I have tried shape.Invalidate()
leovernazza

Setting the Z-Order by itself doesn't fix things. You have to re-order the NestedChildShapes of the diagram.

Take a look at Example.Components that you'll find by opening the VS SDK Samples Browser and look in CustomCode\NestedShapes.cs. Search on FixZOrder.

Note lines like

LinkedElementCollection<ShapeElement> allShapes = movedShape.ParentShape.NestedChildShapes;

...

allShapes.Move(i, allShapes.Count - 1);




- Alan [Microsoft]
Alan Cameron Wills

Changing the ZOrder doesn't change the Z-Order! You need to rearrange the content of the diagram's NestedChildShapes, using the Move operation.

See the Example.Components sample that you'll find by opening the VS SDK Samples browser - it will be in somewhere like Program Files\VisualStudio 2005 SDK\2006.09\VisualStudioIntegration\Samples\DSLTools\Example.DesignerCustomizations\Example.Components

Open Dsl\CustomCode\NestedShapes.cs and search in FixZOrder.

Look particularly at lines like

LinkedElementCollection<ShapeElement> allShapes = movedShape.ParentShape.NestedChildShapes;

allShapes.Move(i, allShapes.Count - 1);




- Alan [Microsoft]
Alan Cameron Wills

Changing the ZOrder doesn't change the Z-Order! You need to rearrange the content of the diagram's NestedChildShapes, using the Move operation.

See the Example.Components sample that you'll find by opening the VS SDK Samples browser - it will be in somewhere like Program Files\VisualStudio 2005 SDK\2006.09\VisualStudioIntegration\Samples\DSLTools\Example.DesignerCustomizations\Example.Components

Open Dsl\CustomCode\NestedShapes.cs and search in FixZOrder.

Look particularly at lines like

LinkedElementCollection<ShapeElement> allShapes = movedShape.ParentShape.NestedChildShapes;

allShapes.Move(i, allShapes.Count - 1);




- Alan [Microsoft]
Alan Cameron Wills
Thanks for your answerS. :)

It's been a while since the last time I took the examples. They are far better in this version.
leovernazza
So another way to put Alan's answer is that at the current time, ZOrder is calculated rather than really stored. You cna play tricks by overriding the ZOrder proeprty and supplying your own implementation, but you cna get some other weird effects happenign if you do, so beware.


Gareth Jones - Developer - DSL Tools & Software Factories Platform [MSFT]
GarethJ - MSFT
reply 8

You can use google to search for other answers

 

More Articles

Starting with DSL Tools
How to generate Hashtable like collection?
Package Load Failure with /NoVsip
Reference from one DSL metamodel to another
Designer and File Associations
DSL and GAT demo
Reading and writing models in June release?
Creating a modelElement at runtime
Why is creating concrete syntax so hard?
How to use a developed DSL?
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Right mouse click on model results in a …
Error with DSL Project Setup
Codegen templates selected at build time
Reflecting domain property value on shap…
Unregister DSL file extension
Upgrade bug: Only 8.1 version of TextTem…
embedding relationship
Can I Generate Code with CodeDom in the …
geometryShape no "Diamond" Sha…
Compartment Shape for Model
How to get a reference to a model within…
No more RedistInstallDir registry value …
How access to a connector property
How to intercept shape double-click event
Text template load a file

Hot Articles

Migrating to May CTP: MissingManifestRes…
How to access to the shape connectors by…
February CTP of DSL Tools is live in the…
Custom TargetEndStyle
CMDS: Missing package guid for commands …
Creating A connector to CompartMent Items
fatal error CTC2013: Can't start preproc…
Role Expressions
UIPAB
Designer code templates - where are they?
Adding/Removing elements in domain model
How to set the tooltip for the shapes an…
IsSerializing property
Cannot add DSL diagram into a Web Project
Extending right-click menu for DSL class

Recommend Articles

Enterprise Library
Designer and File Associations
Problem Extending Notation with icons
How to add a custom dialog for properties?
DSL Tools support for Visual Studio edit…
How to implement Rules in DSL
Name of EventHandler called when Compart…
Package Load Failure Again
Instanciate an external model
Getting validation results
Compartiment with multiple classes to be…
Problems with DSL Tools walk-through
Join the World's Largest Software Factor…
How to: Generate many files from one tem…
How to set formatting to the strings dis…