Visual studio2010 in C # generated, ArcGIS two times developed Basetool DLLs, registered as COM component tlb files, and loaded in ArcMap using

Source: Internet
Author: User

Wrote a title long AH ~ ~ ~

I've known a new gadget these two days, and I've got a record of that, La La ~~~~~.

It's been almost ten years since I've known ArcGIS, from the desktop to the engine two times, but only to recognize the tip of the iceberg,

It always brings a lot of unknown things, to tell the truth, is so love it, because never feel that swim, no border ~~~~~

Arcengine two times development, this thing is not popular now, but its mystery and fun is still infinite ~ ~ ~

Word to return:

I. Previously written basetool,basecommand classes are run in standalone systems and are not individually registered as components in the desktop version of ArcMap that have been used in the BASETOOL structure:

Public AddPolygonSymbol1 ()

public override void OnCreate (object hook)

public override void OnClick ()

public override void OnMouseDown (int Button, int Shift, int X, int Y)

......... Wait a minute

Private Imapcontroldefault M_pmapcontrol = null;

has been passing its current mapcontrol through M_pmapcontrol in OnCreate (object hook), such as This.m_pmapcontrol = hook as imapcontroldefault;

But, instead of the tool you want to refer to in ArcMap, here are a few things to do:

Two. Modify the method of passing hooks in the Basetool,basecommand class,

private iapplication m_application;      

public override void OnCreate (object hook)
{
M_application = hook as iapplication;

If (Hook is imxapplication)

Base.m_enabled = true;
Else
base.m_enabled = false;  

} and correspond to other places in the code, such as

Imxdocument mxdocument = Application. Document as Imxdocument; Dynamic Cast
Iactiveview ActiveView = Mxdocument.activeview;

In short, get the mapcontrol under the things AH.

After the class modification is complete, you can register to generate the TLB file.

Three. Practice, 1. Add the registered code to the code, I directly copy the code in the example, the other method is unknown, to generate a new GUID on its own OK;

2. In Visual Studio, Project right-click Properties, generate, tick "register for COM Interop"

3. Modify [Assembly:comvisible (True)] to ture in the AssemblyInfo.cs of the project;

Then re-make the achievement OK, in the debug below will find the. tlb file, that's what you want:

This step is the source of reference: http://www.cnblogs.com/carekee/articles/2227480.html

Four. Load the TLB file for this tool in ArcMap and use it.

Loading method: Click the small arrow in the red box, any one can

Then, in the Customise dialog box, select Add from File:

When you're done adding, you can see that the Commands tab below Walkthroughs has more of its own defined tools,

Here "walkthroughs" is defined in the code constructor of base.m_category = "walkthroughs";

Plus it's ready to use, and here I'm adding a AddPolygonSymbol1 tool,

Another, I have always been to achieve the purpose of superficial understanding, basetool actually used before,

But do not know how to register as a tool in the desktop version of the use, because the COM component of these things actually do not know very much,

So it's all about fur, just a little.

Problem:

1.com Component registration method, in VS, those code can be automatically generated?

2. Custom generated tool, add picture did not succeed, GetType (). Name these things do not know exactly how to read;

3. How to get rid of the tools loaded on ArcMap ~ ~ ~

4. How do I add a toolbar in addition to the Custom tool button? ~~~~

Please advise the person who knows.

Visual studio2010 in C # generated, ArcGIS two times developed Basetool DLLs, registered as COM component tlb files, and loaded in ArcMap using

Related Article

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.