Select to view content in your preferred language

how to center at a point before flashing it?

911
3
09-13-2010 05:25 AM
charlesmillot
New Contributor
hi all,
I'm trying to use axmapcontrol.centerat and axmapcontrol.flashpoint in a function.
I use flashpoint after the centerat function but it flash the center of the map before moving to the point on which i want to centerat.

 Dim x, y As Double
        Dim bb As Boolean = False
        Dim psymbol As ISymbol
        Dim pfillsymbol As ISimpleMarkerSymbol
        Dim irgbcolor As IRgbColor = New RgbColor
        Dim ppoint As IPoint
        x = CType(TextBox1.Text, Double)
        y = CType(TextBox2.Text, Double)

        ppoint = New ESRI.ArcGIS.Geometry.Point
        ppoint.X = x
        ppoint.Y = y
        ppoint.SpatialReference = axMapControl1.SpatialReference
        irgbcolor.RGB = System.Drawing.Color.Red.ToArgb
        pfillsymbol = New SimpleMarkerSymbol
        pfillsymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond
        pfillsymbol.Color = irgbcolor
        pfillsymbol.Size = 25
        psymbol = CType(pfillsymbol, ISymbol)
        psymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen

        axMapControl1.CenterAt(ppoint)
        axMapControl1.FlashShape(ppoint, 5, 500, psymbol)


can anyone tell me why i have this result and how to center on the point before flashing it ?

Regards

C. MILLOT
0 Kudos
3 Replies
vincentLahaye
Emerging Contributor
here code in C# to zoom on your element.

will not probably work in your code, but technic is the same.

public static void ZoomIn(IMxDocument _itfMxDocument,
                                  IGeometry _itfGeometrie)
        {
           
            if (_itfGeometrie != null)
            {
                IEnvelope itfEnveloppe = _itfGeometrie.Envelope;
                _itfMxDocument.ActiveView.Extent = itfEnveloppe;
                _itfMxDocument.ActiveView.Refresh();
            }
        }


Esri example is :

Dim dX As Double, dY As Double
dX = 1
dY = 1
Dim pPoint As IPoint
pPoint = New PointClass
pPoint.PutCoords(dX, dY)
AxMapControl1.CenterAt(pPoint)


maybe use PutCoords to add your coordinate in your point objet.

Vincent
0 Kudos
JeffMatson
Frequent Contributor
Have you tried calling FlashShape after the screen has finished drawing?  If not you might look into using IMapControlEvents.OnAfterDraw or .OnAfterScreenDraw.
0 Kudos
charlesmillot
New Contributor
Thanks Jeff

It's a good way to solve my matter.

Regards
0 Kudos