You are here: > ESRI Forums > arcgis engine forums > Thread Replies

ArcGIS Engine Forums

ArcGIS Engine: Developer Kit forum

create custom tools   Liu Yu Mar 09, 2009
Re: create custom tools   Michael Knight Mar 09, 2009
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject create custom tools 
Author Liu Yu 
Date Mar 09, 2009 
Message hello£¬teachers£¬when i create my custom tools, i know it will pass an control object to the function named oncreate( object hook), i want to know how is works, i do not call this function and pass an control object,it confuse me , the book says,the hook can be MapControl¡¢PageLayoutControlºÍToolbarControl,i want to know when the form was seen,which control object pass to the hook specific,thank you! 
 
private IHookHelper m_HookHelper = new HookHelperClass();

public override void OnCreate(object hook)

        {

            m_HookHelper.Hook = hook;
       if(hook is IToolbarContronl)

{
 to do something,
can you explain this to me ?
}

        }

 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: create custom tools 
Author Michael Knight 
Date Mar 09, 2009 
Message You have to test the hook object to see what it is. For example

//C#
//From the developer help
ublic override void OnCreate(object hook)
{
if (hook == null)
return;

m_application = hook as IApplication;

//Disable if it is not ArcMap
if (hook is IMxApplication)
base.m_enabled = true;
else
base.m_enabled = false;

// TODO: Add other initialization code
}
 
  Michael Knight
GIS Solutions Architect
Contract Land Staff, LLC
Stafford, Texas

http://www.contractlandstaff.com