Crash when select polygon by mouse cmIdentity

Hi everyone. I’m Tien. I am writing a map in which I want to select polygon on the map. However, when I select polygon there was a error happening.

Although I upgraded up to MapWinGis 5.1.1, this error still happened.
Can you tell me how to do to solve it. Thanks a lot

Hello @tiennguyen, and welcome.

I’m afraid you’ll have to provide more information.

  1. I will assume that the MapWinGIS OCX is placed on the this form, frmConsoleMenu.
  2. It would be most helpful if you could show the call stack to the error, and the Exception details, to see specifically who (what component) is raising the error, and where.

Thank you,
Jerry.

Thank for your answer. Let me explain my problem.

  • I use Mapwingis for frmMain form which is located in frmConsoleMenu form.

  • when I create polygon, polyline on this map, it’s ok. However, I want to select polyline and polygon to edit or show its information . Polygon was createed like image following.

  • There was a problem is that when I set cursorMode of axMap to cmIdentity by event:
    private void selectObject_Click(object sender, EventArgs e)
    {
    if (axMap != null)
    {
    if (axMap.CursorMode != tkCursorMode.cmIdentify)
    axMap.CursorMode = tkCursorMode.cmIdentify;
    else
    axMap.CursorMode = tkCursorMode.cmNone;

          }
      }
    

I moved mouse on map and not yet click mouse, immediately crash occurred like image following.


Note: frmMain form , which used mapwingis, is a child form of frmConsoleMenu.
Here is a statement indicate it:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new frmMain());
clsCommon.gfrmRootMain = new frmConsoleMenu();
Application.Run(clsCommon.gfrmRootMain);
//Application.Run(new Form1());
}
private void frmConsoleMenu_Load(object sender, EventArgs e)
{
if(frmMap == null)
{
frmMap = new frmMain(this);
clsCommon.ShowFormOnPanel(this.panelView, frmMap);
}
}
I did not understand what’s happen. Please help me repair it. Thanks a lot

Thank you, but there’s still not enough information. I have more questions:

  1. Regarding the selectObject_Click handler, what event are you handling? Perhaps ShapeIdentified? It’s not clear from the name.
  2. Do you have HotTracking turned on for the Identifier? (axMap.Identifier.HotTracking property)
  3. Since you’re only moving the mouse, and not clicking, it is not likely related to the event handler. Something else is going on.
  4. It would be most helpful to have the Exception details, including the call stack, to see who is unhappy.

Respectfully,
Jerry