Add Graphic (point) to mouse click location

481
0
02-27-2013 06:13 AM
NeedHelp
New Contributor
Should be a simple task, so I assume I'm just overlooking 1 simple thing.
Just trying to add a dot to the map at the location of mouse click.
My layer gets added into the map fine, and my X&Y values seem fine...but no point gets drawn dispite my attempts to draw the point 2 different ways

My code is:

       GetMxDocument(m_application)
        GetActiveView(m_application)
        Dim pMap As IMap
        pMap = theActiveView.FocusMap
        AddLayerToActiveView(theActiveView, "C:\theLayer.lyr")
        MsgBox(pMap.LayerCount)

        m_pPoint = theActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)
        msgbox (m_pPoint.X & m_pPoint.Y)

        Dim thePoint As ESRI.ArcGIS.Geometry.Point
        DrawPoint(theActiveView, m_pPoint.X, m_pPoint.Y)
        DrawPoint(theActiveView, thePoint.X, thePoint.Y)

        Dim aCol As RgbColor
        aCol.Red = 1
        aCol.Blue = 101
        aCol.Green = 201

        Dim bCol As RgbColor
        aCol.Red = 201
        aCol.Blue = 101
        aCol.Green = 1

        AddGraphicToMap(pMap, m_pPoint, aCol, bCol)
        AddGraphicToMap(pMap, thePoint, aCol, bCol)

        theActiveView.Refresh()
0 Kudos
0 Replies