Please...

Topics: SharpMap Project, SharpMap v0.9 / v1.x
Jul 15, 2008 at 4:24 AM
How Can I Insert One Label On One Point On The Map In Version 1.1 Of Sharpmap??? Thank You Very Much.
Coordinator
Jul 15, 2008 at 7:23 AM
Edited Jul 15, 2008 at 7:27 AM
Hi saminsalemi, the following should help, cheers jd
FeatureDataTable labelData = new FeatureDataTable();
labelData.Columns.Add("Name", typeof (string));
FeatureDataRow r = labelData.NewRow();
r["Name"] = "My Lair";
r.Geometry = new Point(5, 5);
labelData.AddRow(r);
LabelLayer labelLayer = new LabelLayer("labelLayer")

    DataSource = new GeometryFeatureProvider(labelData), 
    Enabled = true, 
    LabelColumn = "Name", 
    Style = new LabelStyle 
        { 
            BackColor = new SolidBrush(Color.Black), 
            ForeColor = Color.White, 
            Halo = new Pen(Color.Yellow, 0.1F), 
            CollisionDetection = false, 
            Font = new Font("Arial", 10, GraphicsUnit.Point) 
        }
};
m.Layers.Add(labelLayer);