Articles in this section
Category / Section

Deactivate zoom Tool and currently active tool

1 min read

Disable Zoom tool

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

However, we can use Esc key to disable currently active tool in application level. Since, we need to use Diagram’s KeyPress event to cancel the currently active tool by using 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 Sub 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 
 

 

 

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