Conflicts that are used by custom tools and self-contained toolbars (ICommand) in Arcengine and other tools

Source: Internet
Author: User

The function of the system itself for zooming in and out is a separate rewrite, but if you add a toolbar with the same functionality, there will be some conflicts between the two, in order to resolve the conflict can rewrite the Onitemclick event of the tool bar

The toolbar is named Axtool

I am writing in the mouse click event of the map itself

The code is as follows:

 Private voidAxmap_onmousedown (Objectsender, ESRI. ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)//Manipulating AE surfaces{Ienvelope penv; Axmap.mousepointer=Esricontrolsmousepointer.esripointercrosshair; Igeometry Geometry=NULL; ESRI. ArcGIS.Geometry.Point Point=NewESRI.            ArcGIS.Geometry.PointClass (); Igraphicscontainer PGC= Axmap.activeview asIgraphicscontainer; AxMap.ActiveView.PartialRefresh (Esriviewdrawphase.esriviewgeography,NULL,NULL);//Refresh All Layers            Switch(flag) { Case 1://Map ZoomPenv =Axmap.trackrectangle (); Penv.expand (0.5,0.5,true); Axmap.extent=penv;  Break;  Case 2://View Zoom outPenv =axmap.extent; Penv.expand (2,2,true); Axmap.extent=penv;  Break;  Case 3://View PanningAxmap.pan ();  Break;}

To add an event for Axtool to resolve conflicts:

 Private voidAxtool_onitemclick (Objectsender, Itoolbarcontrolevents_onitemclickevent e)//resolve the conflict after the toolbar is clicked and used by other tools        {            //First reset Map current toolFlag =-1;//Invalid setting current map ClickAxmap.currenttool =NULL;//set the current map tool to be empty            intToolnum = E.index;//get the index of the Click Tool on the tool barICommand _command = AxTool.CommandPool.get_Command (toolnum);//get the Click Command based on the following flagAxmap.currenttool = _command asItool;//set the command for the current map for the command_command. OnClick ();//The response should be ordered}

This will resolve the conflict successfully.

Conflicts that are used by custom tools and self-contained toolbars (ICommand) in Arcengine and other tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.