Articles in this section
Category / Section

Deactivate zoom Tool and currently active tool

4 mins read

Disable Zoom Tool

By default, we can press Ctrl+Shift+P keys to disable the zoom functionality and enable the normal selection cursor in the diagram control.

However, we can use the Esc key to disable the currently active tool at the application level. Since we need to use the Diagram’s KeyPress event to cancel the currently active tool by using the Diagram.Controller’s "DeactivateTool()" method.

 

The following code example is used to disable currently active tool (i.e. ZoomTool).

[C#]

// Registering the event to the diagram controller
diagram1.KeyPress += diagram1_KeyPress;

private void diagram1_KeyPress(ByVal sender As object, ByVal e As KeyPressEventArgs)
{
    if (e.KeyChar == Convert.ToChar((char)(Keys.Escape)))
    {
        diagram1.Controller.DeactivateTool(diagram1.Controller.ActiveTool);
    }
}

 

[VB]

' Registering the event to the diagram controller
AddHandler diagram1.KeyPress, AddressOf diagram1_KeyPress

Private Sub diagram1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
    If e.KeyChar = CChar(ChrW(Keys.Escape)) Then
        diagram1.Controller.DeactivateTool(diagram1.Controller.ActiveTool)
    End If
End Sub

 

Conclusion

I hope you enjoyed learning about Deactivate zoom Tool and currently active tool.

You can refer to WinForms Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusio, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied