We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Zoom - set % directly? zoom but not be editable?

Is it possible to programmatically set the Zoom %? For example, I want to give users a slider control to toggle the zoom, or a dropdown box with select values: 50%, 75%, 100%, 200%, 400%, etc.

Also, is it possible to enable Zooming on a grid using ctrl+mouse, but not allow a user to edit the shapes in the diagram? I found that Zooming with the mouse only works if IsPageEditable is set to TRUE.

2 Replies

NA Nikhil A Syncfusion Team July 27, 2009 08:21 AM UTC

Hi James,

Thanks for your interest in Syncfusion products.

1) Yes we can specify the diagram view to zoom in terms of percentage by using the following code:( say for a combo box Selected event Handler)

Specify the percentage values for each combo box item.










//Selected item event handler


//Keeps track of the current zoom
double currentfactor = 1;

private void ComboBoxItem_SelectedItem(object sender, RoutedEventArgs e)
{
ComboBoxItem item = (ComboBoxItem)sender;
string c = item.Content.ToString();
string number = c.Substring(0, c.Length - 1);
double num=Convert.ToDouble(number)/ 100;

//Calculate the factor by which to zoomin/out to resize the view to the desired percentage.
diagramView.ZoomFactor = Math.Abs(currentfactor - num);

//Calculate whether to zoom in or zoom out depending on the currentfactor value.
if (currentfactor > num)
{
ZoomCommands.ZoomOut.Execute(diagramView.Page, diagramView);
}
else
{
ZoomCommands.ZoomIn.Execute(diagramView.Page, diagramView);
}

currentfactor = num;
}

2)On setting IsPageEditable, the zoom operation itself is disabled . Therefore in order to enable zooming using ctrl+mousewheel, the IsPageEditable property can be set as True.

Now to disable editing of nodes , the AllowSelect property of the node can be set to false. (When node selection is diabled, then node drag, rotation and resizing are automatically disabled as all these operations can be performed only after the node is selected). However connectors will still be selectable and we will provide an equivalent property for connectors in our Volume 4 release of Essential Diagram which is scheduled to be in the month of October 2009.

The AllowSelect property can be set in the following way:

nodeobj.AllowSelect=false;

To set for all the nodes on the page, the following code can be used:



This will set the AllowSelect property of all the nodes on the page to false.

Please let us know if there are any concerns.

Regards,
Nikhil



JF James Foster January 21, 2011 09:59 PM UTC

Has the AllowSelect property been added for LineConnectors?

What I am looking to know is whether, in the latest releases, there is an easy way to:

a) Only allow users to select nodes
b) Only allow users to select a single node at a time
c) Hook into some sort of node-selecting event when the diagram is databound to a hierarchical data source

Users should not be able to resize nodes, rotate nodes, delete nodes, or delete connectors. Just click on a node to tag it as "selected".

Any new features to support that? IsPageEditable prevents the selection, but there do not seem to be enough properties to shut off all the other editing features other than Selection.


Loader.
Live Chat Icon For mobile
Up arrow icon