Design and Implementation of Columns Under ArcMap

Source: Internet
Author: User

The UI style In ArcMap 9.3 Is really rough, and it is quite cool than many software UIS in China. However, the importance of ArcMap in GIS editing is self-evident. Recently, I want to try to gain a deeper understanding of ArcMap customization. The customizable components of ArcMap include menus, toolbar, and dock columns. The first two may have been used by users. There are also many examples, which can be found in various languages and codes, the dashboard can also be found on the Internet. There are many VBA and C #, but the code developed by C ++ is not. The reason is that it is not easy to embed the form into the dashboard.

Before developing a custom dashboard, let's talk about how to use the dashboard. In ArcMap, the TOC control is the most commonly used Dock bar, and the quality check control is also the Dock bar. If the attributes involved in user interaction are closely related to graphic display, we strongly recommend that you use the Dock bar method. For example, in the quality control process, if a large amount of information needs to be determined through graphical relationships, opening an Attribute Table is not very convenient. It should be easy for the Attribute Table and map to mask each other and affect interaction, especially when there is a large amount of data.

The topic involves how to develop. Many people ask online how to develop, especially C ++. In fact, it is not easy to develop C ++, because you need to precisely control every process of a non-modeled window, manual control is required from creation to destruction.

In Versions later than 9.3 (10.0, 10.1), the style of ArcMap has completely changed. The style is similar to office2007, which may eliminate the development requirements of users in the next section of 9.3. However, after reaching out to many users, I found that most users still get used to 9.3, and 9.3 of users are huge.

To start the development of the dock bar, we need to prepare the development environment, vc6, and arcmap9.3. Better if you are familiar with ATL.

1. Prepare a test case. I do it very easily, that is, a command is used to activate the dock.

Stdmethod (onclick) () {hresult hr; idockablewindowmanagerptr ipdockablewindowmanager; ipdockablewindowmanager = m_ipdispatch; iuidptr ipuid (clsid_uid); HR = ipuid-> put_value (ccomvariant ("{F884D1F0-C82F-40F1-A2EB-359D51F635F7 }")); idockablewindowptr ipdockablewindow; // instantiate the dock component hR = ipdockablewindowmanager-> getdockablewindow (ipuid, & ipdockablewindow); variant_bool varvisual; HR = ipdockablewindow-> isvisible (& varvisual ); // If (varvisual = variant_true) {// obtain the iwindowpositionptr ipwindowposition; ipwindowposition = ipdockablewindow; long width; long height; hR = ipdockablewindow-> show (variant_true); HR = ipdockablewindow-> dock (esridockbottom); HR = ipwindowposition-> get_width (& width ); hR = ipwindowposition-> get_height (& height);} return s_ OK ;}

2. Extended idockablewindowdef

Stdmethod (oncreate) (idispatch * hook) {// pass iapplication; hresult hr; iapplicationptr ipapplication; ipapplication = hook; ole_handle appolehandle; HR = ipapplication-> get_hwnd (& appolehandle ); hwnd = (hwnd) appolehandle; m_tableform.create (hwnd, (lparam) (Hook); // m_tableform.create (hwnd ); atltrace ("\ n *** new window \ n"); Return s_ OK ;}

3. Create your own window components

4. add your own attribute list

The property list is placed on the property page. The property page is embedded in each tab control,

        LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
M_ipdispatch = (idispatch *) lparam; If (m_ipdispatch = NULL) return 0; uses_conversion; hresult hr; // Add a tab page // path from DLL tchar szfullpathname [_ max_path]; getmodulefilename (hmodule) (_ module. m_hinst), szfullpathname, _ max_path); tchar drive [_ max_drive]; tchar dir [_ max_dir]; tchar fname [_ max_fname]; tchar ext [_ max_ext]; _ wsplitpath (szfullpathname, drive, Dir, fname, ext); tchar szpathofmdb [_ max_path]; Wcscpy (szpathofmdb, drive); wcscat (szpathofmdb, DIR); wcscat (szpathofmdb, _ T ("diyingli. mdb "); ccombstr bstrpathofmdb = szpathofmdb; // open MDB extends ipwsf (bytes); iworkspaceptr ipworkspace; HR = ipwsf-> openfromfile (bstrpathofmdb, null, & ipworkspace ); if (failed (HR) {: MessageBox (null, _ T ("no earth stress database found"), _ T ("error"), mb_iconerror); return 1 ;} // open the database and load the spatial data table // esridttable Istringarrayptr ipstringarray (clsid_strarray); ienumdatasetnameptr ipenumdatasetname; HR = ipworkspace-> partition (esridttable, & ipenumdatasetname); HR = ipenumdatasetname-> Reset (); idatasetnameptr ipdatasetname; while (! Ipenumdatasetname-> next (& ipdatasetname) {ccombstr bstrname; HR = ipdatasetname-> get_name (& bstrname); HR = ipstringarray-> Add (bstrname);} Long lstrcount; hR = ipstringarray-> get_count (& lstrcount); hwnd = getdlgitem (idc_tab1); // get name and table info from GDB for (long I = 0; I <lstrcount; I ++) {ccombstr bstritemname; HR = ipstringarray-> get_element (I, & bstritemname); tcitem TCI; TCI. mask = tcif_text; TCI. psztext = ole2t (bstritemname); TCI. cchtextmax = wcslen (ole2t (bstritemname) + 1; TCI. iimage =-1; TCI. lparam = 0; tabctrl_insertitem (hwnd, I, & TCI); // Add Table to tab control itableptr iptable; paiipfws; ipfws = ipworkspace; HR = ipfws-> OpenTable (bstritemname, & iptable); // Add the attribute page addtabletotabcontrol (iptable, hwnd);} // send the message tcn_selchange // set the first attribute page of the tab to display the nmhdr; nmhdr. code = tcn_selchange; nmhdr. hwndfrom = hwnd; nmhdr. idfrom = idc_tab1;: sendmessage (hwnd, wm_notify, makelong (tcn_selchange, 0), (lparam) (& nmhdr ));
return 1;  // Let the system set the focus
}

 

The final result is the figure below.

 

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.