I currently am trying to load different shp files in ArcObjects progromatically. Currently I can load lines,polylines, polygons and ellipses (even though that's just a fancy polygon as far as ArcObjects is concerned).
However, I'm having a problem loading Text. Basically it's a point on a map with some text above it.
This is how I'm trying to load the shape File. Note this is basically the same thing I do for polygons, polylines,and ellipses. The only notable difference is ITextSymbol as opposed to ISimpleFillSymbol for Polygons or ISimpleLineSymbol for Lines
IFeatureLayer featureLayer = new FeatureLayerrClass();
featureLayer.FeatureClass = myFeatureClass //Loaded from the featureWorkspace
featureLayer.Name = featureClass.AliasName;
featureLayer.Visibile = true;
IGeoFeatureLayer layer = featureLayer as IGeoFeatureLayer;
IRgbColor textColor = new RgbColorClass();
textColor.Red = 255;
textColor.Blue = 0;
textColor.Green =0;
ITextSymbol textSymbol = new TextSymbolClass();
textSymbol.Color = textColor;
textSymbol.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(new Font("Arial", 12 , FontStyle.Bold);
textSymbol.Size = 12;
textSymbol.Text = myText;
ISimpleRenderer simpleRenderer = new SimpleRendererClass();
simpleRenderer.Symbol = textSymbol as ISymbol;
geoFeatureLayer.Renderer = simpleRenderer;
myAxMap.AddLayer(geoFeatureLayer as ILayer);
Invalidate();