Use IIdentifyDialog to simulate the Identify function In ArcMap for element Query

Source: Internet
Author: User

Use the IIdentifyDialog provided by AE to create the class identifyTool. Then, you can click the button in the program to simulate the Identify function in the ArcMap tool.
Class Generation Code:

1 public sealed class identifyTool: BaseTool
2 {
3 IHookHelper pHookHelper = new HookHelperClass ();
4 public identifyTool ()
5 {
6 m_cursor = new System. Windows. Forms. Cursor (@ "... \ .. \ Resources \ Identify_md.cur ");
7
8}
9
10 public override void OnCreate (object hook)
11 {
12 pHookHelper. Hook = hook;
13}
14 public override void OnMouseDown (int Button, int Shift, int X, int Y)
15 {
16
17 IActiveView pActiveView;
18 IIdentifyDialog pIdentifyDialog;
19 IIdentifyDialogProps pIdentifyDialogProps;
20 IEnumLayer pEnumLayer;
21 ILayer pLayer;
22
23 pActiveView = pHookHelper. ActiveView;
24
25 pIdentifyDialog = new IdentifyDialogClass ();
26 pIdentifyDialogProps = pIdentifyDialog as IIdentifyDialogProps;
27 pIdentifyDialog. Map = pHookHelper. ActiveView. FocusMap;
28 pIdentifyDialog. Display = pActiveView. ScreenDisplay;
29
30 pIdentifyDialog. ClearLayers ();
31
32 pEnumLayer = pIdentifyDialogProps. Layers;
33 pEnumLayer. Reset ();
34 pLayer = pEnumLayer. Next ();
35 while (pLayer! = Null)
36 {
37 pIdentifyDialog. AddLayerIdentifyPoint (pLayer, X, Y );
38 pLayer = pEnumLayer. Next ();
39}
40 pIdentifyDialog. Show ();
41}
42}

M_cursor is used to set the mouse style.
The Map and Display attributes of IIdentifyDialog must be set.
(Refer to ESRI China Community)

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.