Regarding diagram1.View.ZoomToSelection() method, |
Please note that, the ZoomSelection() method is used to zoom the selected/particular region and it shows the full view of the selected region. So, if you are trying to zoom same region again, then zooming is based on already zoomed value (i.e. diagram.view’s Magnification property value)
For example: After zooming the Diagram.View’s Magnification to 300 and once again if we perform zoom operation the zooming will considered from 300(old magnification value) only not from 100.
So, we suggest you to use Diagram's "ZoomTo()" method in order to achieve Zoom the Diagram based on the Node’s position and set below parameters as follows,
1. FocusPoint : Determines the point to zoom.
2. ZoomCommand : Determines whether ZoomIn/ZoomOut.
3. ZoomIncrement : Determines the value to zoom.
Please refer to the below code example.
Code example:
[C#]
var node = diagram1.Model.Nodes.FindNodeByName("Rectangle1");
ZoomParameters zoom = new ZoomParameters();
zoom.FocusPoint = node.BoundingRectangle.Location;
zoom.ZoomCommand = ZoomCommand.ZoomIn;
zoom.ZoomIncrement = 25;
diagram1.ZoomTo(zoom);
Also, please refer to the below sample.
Sample:
|
2) I do not understand either :
diagram1.View.ZoomType = ZoomType.Center
|
The diagram document can be zoomed to the center of the current viewport by setting the ZoomType as Center. |
3) diagram1.View.ZoomToActual();
What view is supposed to be returned ? In my case diagram disappear I need to use scrollbars to get it back in the view.
|
ZoomToActual() is used to zoom the diagram as initial/actual size (i.e. Diagram.View’s Magnification value is set as 100).
|