The best approach to run a system tool—or any tool or model created, and saved in a toolbox from a button—is to create an add-in control. Add-in controls are a new feature in ArcGIS 10. You can create an add-in control through the Customize dialog box by selecting the Commands tab category, then Add-in Controls. For more information on getting started with add-ins, see Building add-ins for ArcGIS Desktop.
Once created, you can add the control to toolbars or menus. When you click a button (for example, in ArcMap), its OnClick method is called.
To start a geoprocessing tool from the button, copy and paste the following code example inside the code block of the OnClick method. The InvokeModal method of the IGPToolCommandHelper2 interface is called to open the tool. Remember to replace the name of the toolbox, and the name of the tool or script you want to reference. Pay close attention to the tool's actual location and name, not its label. You can get this information by right-clicking the tool in Catalog and reviewing the properties. For more information, see Toolbox properties: name, label, and alias in the ArcGIS Desktop User Help system. 
When you add the control, you can click the button and the Buffer tool appears. See the following code example:

[C#]

protected override void OnClick()
{ //Set a reference to the IGPCommandHelper2 interface.
IGPToolCommandHelper2 pToolHelper = new GPToolCommandHelperClass()as
IGPToolCommandHelper2; //Set the tool you want to invoke.
string toolboxName = @
"<ArcGIS install directory>\ArcToolbox\Toolboxes\Analysis Tools.tbx";
pToolHelper.SetToolByName(toolboxName, "Buffer"); //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); } //============================

using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using System.Windows.Forms;
using ESRI.ArcGIS.Geodatabase;
//using ESRI.ArcGIS.GeoDatabaseUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.ArcMapUI;

using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesRaster;

using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.Display;

using System.IO;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.GeoprocessingUI;

 

private void myinfo()
{
IGPToolCommandHelper2 pToolHelper = new GPToolCommandHelperClass() as
IGPToolCommandHelper2;

//Set the tool you want to invoke.
string toolboxName = @"D:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Analysis Tools.tbx";
pToolHelper.SetToolByName(toolboxName, "Buffer");

//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);
}

 

AE 打开工具箱工具的对话框的更多相关文章

  1. Mac下safari、chrome打开开发者工具快捷键

    mac下safari和chrome打开开发者工具的快捷键相同,都是option(alt)+command+i 这个是我的默认配置,没有更改过的.

  2. MFC中打开选择文件夹对话框,并将选中的文件夹地址显示在编辑框中

    一般用于选择你要将文件保存到那个目录下,此程序还包含新建文件夹功能 BROWSEINFO bi; ZeroMemory(&bi, sizeof(BROWSEINFO));  //指定存放文件的 ...

  3. MAC 打开Chrome打开开发者工具的快捷键

    mac下safari和chrome打开开发者工具的快捷键相同,都是 option(alt)+command+i 这个是我的默认配置,没有更改过的.

  4. 利用C#与AE调用GP工具

    转自原文 利用C#与AE调用GP工具 第一,首先要明确自己需要调用arctoolbox里面的什么工具,实现什么样的功能. 第三,编写command或tool工具,编写自己要的功能工具. 1)首先创建一 ...

  5. 一款批量修改AE模板的工具

    一.需求分析 对于视频后期剪辑及相关从业人员来说,AE(After Effects)模板效果是一个不错的开始点.在模板效果的基础上,可以很快的做出各种炫酷的后期效果.但是在网上下载的模板工程中,往往包 ...

  6. 如何解决-win7系统打开截图工具显示“截图工具当前未在计算机上运行”

    打开win7系统自带截图工具,显示"截图工具当前未在计算机上运行.请重新启动计算机,然后重试",  解决方法  1.首先在C盘中搜索tpcps.dll: 2.将数据最大那个tpcp ...

  7. IE9浏览器打开开发者工具代码正常执行,反之报错

    1.can i use console  IE9开发者工具打开时支持console对象,否则报错. 2.由于出现错误 80020101 而导致此项操作无法完成 测试代码 <!DOCTYPE ht ...

  8. 解决Android studio导航tools下没有android怎么打开DDMS工具

    因为这个功能用的人少, 新版本就去掉菜单入口了, 但这个功能并没有删除,打开方式:点开terminal ,也就是AS自带的命令行工具, 输入monitor 回车就启动了, 1.点开terminal 2 ...

  9. Electron 打开开发者工具 devtools

    转载:http://newsn.com.cn/say/electron-devtools.html 在electron开发的过程中,可以用代码控制打开自带chrome的devtools开发者工具,进而 ...

随机推荐

  1. PHP中的魔术方法和关键字

    PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep ...

  2. Codeforces 375D - Tree and Queries(dfs序+莫队)

    题目链接:http://codeforces.com/contest/351/problem/D 题目大意:n个数,col[i]对应第i个数的颜色,并给你他们之间的树形关系(以1为根),有m次询问,每 ...

  3. 数据分析python应用到的ggplot

    数据分析中应用到python中的ggplot库,可以用来画图 数据之类的用优达学院中课程七中的数据为例 数据是:https://s3.amazonaws.com/content.udacity-dat ...

  4. 数据库介绍及MySQL安装

    阅读目录 一.数据库是什么? 二.数据库特点 三. 什么是数据库管理系统(DataBase Management System 简称DBMS) 四.数据库服务器.数据管理系统.数据库.表与记录的关系( ...

  5. js中的cookie使用和vue-cookie的使用

    在HTTP协议的定义中,采用了一种机制来记录客户端和服务器端交互的信息,这种机制被称为cookie,cookie规范定义了服务器和客户端交互信息的格式.生存期.使用范围.安全性. 在JavaScrip ...

  6. gym101431B

    以此纪念我都快忘了的后缀自动机(捂脸) 不过这题有两种做法: 用后缀自动机,先把原串再接遍中间加入特殊连接字符再把原串反接两遍,对这个新构造出的串做后缀自动机.(或者直接建立广义后缀自动机) 下面只要 ...

  7. win10家庭版和专业版远程桌面出现身份验证错误, 要求的函数不受支持。解决办法【亲测有效】

    1.解决 win10家庭中文版 远程连接:出现身份验证错误 要求的函数不受支持 Windows 5.10日更新后,远程连接出现失败. 提示: 出现身份验证错误.要求的函数不受支持 这可能是由于 Cre ...

  8. html5弹性布局两则,有交互。

    要开发一个后台管理框架,要求如下效果. 然后开始找各种弹性布局啊什么的,用了flex写了一个,但是觉得不好,首先是兼容,其次它会破坏掉里面子元素的一些css特性,为了不给自己找麻烦我还是用传统写法吧. ...

  9. 【BZOJ】4311: 向量(线段树分治板子题)

    题解 我们可以根据点积的定义,垂直于原点到给定点构成的直线作一条直线,从正无穷往下平移,第一个碰到的点就是答案 像什么,上凸壳哇 可是--动态维护上凸壳? 我们可以离线,计算每个点能造成贡献的一个询问 ...

  10. bzoj 1116

    思路:每个连通块都判是否有环. #include<bits/stdc++.h> #define LL long long #define fi first #define se secon ...