Engine中如何弹出GP工具界面?

Engine中如何弹出GP工具界面?想要弹出CreateCustomGeoTransformation工具的界面?
已邀请:

朱新颖

赞同来自:

【解决办法】:
程序中想要弹出GP工具对话框,Engine产品的许可无法调用,只能使用Desktop产品的许可(Basic,Standard或者Advanced)。需要注意如果是使用Desktop产品的许可是不能使用MapControl、ToolbarControl、LicenseControl等控件的。
主要接口为IGPToolCommandHelper2,下面代码可供参考:


RuntimeManager.Bind(ProductCode.Desktop); 
ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); 
ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeAdvanced); 

IGPToolCommandHelper2 pToolHelper = new GPToolCommandHelperClass() as IGPToolCommandHelper2; 

//Set the tool you want to invoke. 
string toolboxName = @D:\install_software\ArcGIS 10.3.1\Desktop10.4\ArcToolbox\Toolboxes\Data Management Tools.tbx;//该工具所在路径 
pToolHelper.SetToolByName(toolboxName, CreateCustomGeoTransformation); //想要调用的工具Name

//Create the messages object and a bool to pass to the InvokeModal method. 
IGPMessages msgs; 
msgs = new GPMessagesClass(); 
bool pok = true; 

//Invoke the tool. 
pToolHelper.InvokeModal(0, null, out pok, out msgs);

要回复问题请先登录注册