Creating the Hello, ArcGIS add-in project
In this section, we will show how to create an add-in project using Visual Studio. To
create an add-in project for ArcGIS, follow these steps:
1. From the Start menu, locate and run Microsoft Visual Studio.
2. From the Visual Studio application, point to the File menu and then click on
New Project.
3. Under the Templates node, expand Visual Basic, this is the language we will
be programming with, then expand ArcGIS, and click on Desktop Add-ins.
You can write add-ins for all ArcGIS for Desktop products as you can see.
We want to write add-ins on top of ArcMap, so select ArcMap Add-ins.
4. In the Name field, type the name of the project
Click on OK, this will show the ArcGIS Add-in Wizard.
6. We can use the wizard to autogenerate our controls and other codes, but we
are going to do that manually, so simply click on Finish to create the project.
Once the project has been created, you will see two files: config.esriaddinx
and an image as an icon for your add-in. The config.esriaddinx file
contains metadata about your project like the name and description. To add
a functionality to our project, we need to add a control to do this, point to the
Project menu and then click on Add Class.
8. From the Common Items node expand the ArcGIS node and then click on
Desktop Add-ins. Click on Add-in Component and call it btnHelloArcGIS,
and then click on Add.
9. From the Add-in Wizard, select Button, for the button caption type Hello
ArcGIS and then click on Finish.
10. This adds two files: a class and an image. Double-click on the
btnHelloArcGIS class.
11. Note that this class inherits from a base class ESRI.ArcGIS.Desktop.
AddIns.Button, which will give it the functionality of a button. What is
interesting for us here is the onClick event, which is the code that will get
executed when one clicks on the button. Write the following code in the
onClick event
In this section, we will show how to create an add-in project using Visual Studio. To
create an add-in project for ArcGIS, follow these steps:
1. From the Start menu, locate and run Microsoft Visual Studio.
2. From the Visual Studio application, point to the File menu and then click on
New Project.
3. Under the Templates node, expand Visual Basic, this is the language we will
be programming with, then expand ArcGIS, and click on Desktop Add-ins.
You can write add-ins for all ArcGIS for Desktop products as you can see.
We want to write add-ins on top of ArcMap, so select ArcMap Add-ins.
4. In the Name field, type the name of the project
Click on OK, this will show the ArcGIS Add-in Wizard.
6. We can use the wizard to autogenerate our controls and other codes, but we
are going to do that manually, so simply click on Finish to create the project.
Once the project has been created, you will see two files: config.esriaddinx
and an image as an icon for your add-in. The config.esriaddinx file
contains metadata about your project like the name and description. To add
a functionality to our project, we need to add a control to do this, point to the
Project menu and then click on Add Class.
8. From the Common Items node expand the ArcGIS node and then click on
Desktop Add-ins. Click on Add-in Component and call it btnHelloArcGIS,
and then click on Add.
9. From the Add-in Wizard, select Button, for the button caption type Hello
ArcGIS and then click on Finish.
10. This adds two files: a class and an image. Double-click on the
btnHelloArcGIS class.
11. Note that this class inherits from a base class ESRI.ArcGIS.Desktop.
AddIns.Button, which will give it the functionality of a button. What is
interesting for us here is the onClick event, which is the code that will get
executed when one clicks on the button. Write the following code in the
onClick event
ليست هناك تعليقات:
إرسال تعليق