Problem with Measuring tool

i work with MapWingis 4.8 i have problem with measuring tool


        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

Hello @titif, and welcome.

Perhaps you’ve seen the online help: Measuring Class

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.

thank you for answering my question.
cap

axMap1.CursorMode = tkCursorMode.cmMeasure;

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

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?

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
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

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.

1 Like

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