Click here to Skip to main content
11,927,600 members (47,786 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Dear Friends:

I am using MapXtreme 2008 With C# I have very basic problem I need to create text on a specific X,Y. I am reading and trying but not able to do it.
I am able to insert images on a specific X,Y but not text I am really embraced with this problem. can anyone help me.
please help me.


Nabeel Ahmad.

please see the code

private void MapInfo_Geometry_LegacyText(double X1,double Y1, string MyText)
        Feature ftr;
        // Create a CoordSys for the Geometry to use.
        MapInfo.Geometry.CoordSysFactory factory = Session.Current.CoordSysFactory;
        MapInfo.Geometry.CoordSys csysWGS84 = factory.CreateCoordSys("EPSG:4326");
        double X2 = X1 + 0.01555;
        double Y2 = Y1 - 0.00173;
        DPoint pt = new MapInfo.Geometry.DPoint(X1, Y1);
        // Create LegacyText            
        MapInfo.Geometry.DRect rect = new MapInfo.Geometry.DRect(X1, Y1, X2, Y2);
        MapInfo.Geometry.LegacyText ltxt = new MapInfo.Geometry.LegacyText(csysWGS84, rect, MyText);
        double X = double.Parse(label_X.Text);
        double Y = double.Parse(label_Y.Text);
        TextFactory.CreateLegacyText(mapControl_Fs.Map.GetDisplayCoordSys(), pt, Alignment.TopCenter, label_INCIDENT_ID_1.Text, mapControl_Fs.Map, new MapInfo.Styles.Font("Microsoft Sans Serif", 20));
        MapInfo.Geometry.FeatureGeometry g = new MapInfo.Geometry.Ellipse(csysWGS84, pt, 0.003, 0.003, DistanceUnit.Kilometer, DistanceType.Spherical);
        MapInfo.Styles.SimpleInterior sis = new MapInfo.Styles.SimpleInterior(2, Color.Red);
        MapInfo.Styles.LineWidth lw = new MapInfo.Styles.LineWidth(1, MapInfo.Styles.LineWidthUnit.Point);
        MapInfo.Styles.SimpleLineStyle sl = new MapInfo.Styles.SimpleLineStyle(lw, 3, Color.Empty);
        MapInfo.Styles.AreaStyle ar = new MapInfo.Styles.AreaStyle(sl, sis);
        MapInfo.Styles.CompositeStyle cs = new MapInfo.Styles.CompositeStyle(ar, null, null, null);
        MapInfo.Mapping.FeatureOverrideStyleModifier fsm = new MapInfo.Mapping.FeatureOverrideStyleModifier("a", cs);
        MapInfo.Data.MIConnection conn = new MapInfo.Data.MIConnection();
        MapInfo.Data.Table tbl;
        //Here I need to Make sure that the temporary table does not exist before creating.

        tbl = conn.Catalog.GetTable("tbl_PointAdd");
        if (tbl != null)
        MapInfo.Data.TableInfoMemTable ti = new MapInfo.Data.TableInfoMemTable("tbl_PointAdd");
        ti.Temporary = true;
        tbl = conn.Catalog.CreateTable(ti);
        MapInfo.Mapping.FeatureLayer lyr = new MapInfo.Mapping.FeatureLayer(tbl, "tbl_PointAnimation");
        MapInfo.Data.MICommand cmd = conn.CreateCommand();
        ftr = new MapInfo.Data.Feature(g, cs);
        lyr.VolatilityHint = MapInfo.Mapping.LayerVolatilityHint.Animate;
    catch (Exception ex) 
Posted 10-May-13 23:17pm
Edited 11-May-13 1:12am
Richard MacCutchan 11-May-13 4:26am
Please show your code, no one can guess what it is doing.
nabeeel ahmed 11-May-13 6:24am
Mr. Richard: Actually I do not know that I am using right method to insert the text on a specific XY, if you know can you please send me a piece of code to insert text on the map at specific coordinate. Thank you, Regards: Nabeel Ahmad
Richard MacCutchan 11-May-13 6:25am
Sorry, but I have no knowledge of MapXtreme so I could not comment.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Sometime, taking some time to actually read the documentation helps!

Check this out: MapXtreme Developer's Guide. See page 253 and onwards
nabeeel ahmed 11-May-13 7:37am
Venerable Ryan Zahra: sure I have read many time as well as I have also getting knowledge from this website
but I am not succeeded. I do not know where I am wrong. anyhow if someone has the answer or piece of code for some lines I will appreciate it.
Thank You,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 11 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100