# Problem with Measuring tool

**URL:** <https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155>\
**Category:** Uncategorized\
**Created:** [December 10, 2021, 9:48am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155 "2021-12-10T09:48:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![titif](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@titif](https://mapwindow.discourse.group/u/titif)\
**Post date:** [December 10, 2021, 9:48am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/1 "2021-12-10T09:48:38Z")

</div>

i work with MapWingis 4.8 i have problem with measuring tool

```auto

        private void toolStripButton8_Click(object sender, EventArgs e)
        {
            axMap1.CursorMode = tkCursorMode.cmMeasure;
            
        }

        private void toolStripButton9_Click(object sender, EventArgs e)
        {
            axMap1.Measuring.MeasuringType = tkMeasuringType.MeasureArea;
               
        }

```

thank you

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [December 13, 2021, 5:34am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/2 "2021-12-13T05:34:04Z")

</div>

Hello @titif, and welcome.

Perhaps you’ve seen the online help: [Measuring Class](https://www.mapwindow.org/documentation/mapwingis4.9/class_measuring.html#details)

Can you be more specific about what the problem is? You are setting the CursorMode = cmMeasure, which is correct. You should then be able to left-click to add points to the measuring tool and see the distance between those points.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![titif](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@titif](https://mapwindow.discourse.group/u/titif)\
**Post date:** [December 13, 2021, 1:46pm UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/3 "2021-12-13T13:46:48Z")

</div>

thank you for answering my question.  
 ![cap](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/8b71164d8d28b07cc055170c0205436353dd90a5.jpeg)

axMap1.CursorMode = tkCursorMode. **cmMeasure;**

the problem is with the code “cmMeasure;” the error is that tkCursorMode does not contain a definition for cmMeasure  
Regards,

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [December 13, 2021, 8:01pm UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/4 "2021-12-13T20:01:10Z")

</div>

Hello @titif

The current GitHub history doesn’t go back as far as 4.8, so I can’t verify whether or not cmMeasure was defined in that version. Is there a reason you are not using the latest version?

---

<div class="post-metadata">

**Author:** ![titif](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@titif](https://mapwindow.discourse.group/u/titif)\
**Post date:** [December 14, 2021, 9:25am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/5 "2021-12-14T09:25:54Z")

</div>

Hello @jerryfaust  
the Reason I don’t use the latest version is that I need the legend so only version 4.8 which contains the legend.  
 ![Capture d’écran 2021-12-14 101624](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/842aff9ffbcc336a169d99cb97c10329e8076285.jpeg)  
I would like to work with the latest version or with 4.9 because it contains more functionality but the legend remains for me essential.  
if you have a solution I will be very very grateful.  
thanks in advance

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [December 17, 2021, 7:35am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/6 "2021-12-17T07:35:20Z")

</div>

What I’ve done in the past is to write my own legend using a treeview control. You would include layers at the top level and if you wanted, you could show details below each layer (icons, for example, or line colors) that correspond to the different drawing categories. You can turn on and off layers using the checkboxes, and add right-click menus as necessary. It’s a bit of work up front, but since it is no longer built into the OCX, you will have to create it in your program, outside of the OCX.

It occurs to me now that there is a legend in the MapWinGIS Demo program that is distributed with the source code (C:\dev\MapWinGIS\demo). If you download the source code from GitHub and check out the demo program (written in c#), you can probably use that code as your starting point, and add features from there as necessary.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![titif](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@titif](https://mapwindow.discourse.group/u/titif)\
**Post date:** [December 30, 2021, 8:35am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/7 "2021-12-30T08:35:56Z")

</div>

thank you very much @jerryfaust  
for your help i will try what you have to suggest

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 9:47am UTC](https://mapwindow.discourse.group/t/problem-with-measuring-tool/1155/8 "2022-01-05T09:47:41Z")

</div>

Closed on January 5, 2022, 9:47am UTC


