样例
做法【这个很简单,看一下就能懂】
代码
private void 添加标题ToolStripMenuItem_Click(object sender, EventArgs e) { { IGraphicsContainer graphicsContainer = mainPageLayoutControl1.PageLayout as IGraphicsContainer; IEnvelope envelope = new EnvelopeClass(); envelope.PutCoords(-14, 20, 35, 29);//上下左右 IRgbColor pColor = new RgbColorClass() { Red = 0, Blue = 0, Green = 0 }; IFontDisp pFont = new StdFont() { Name = "宋体", Bold = true } as IFontDisp; ITextSymbol pTextSymbol = new TextSymbolClass() { Color = pColor, Font = pFont, Size = 30 }; ITextElement pTextElement = new TextElementClass() { Symbol = pTextSymbol, ScaleText = true, Text = DateTime.Now.ToString("yyyy年M月d日") + "重庆渝东南地区景点分布图" }; IElement element = pTextElement as ESRI.ArcGIS.Carto.IElement; element.Geometry = envelope; graphicsContainer.AddElement(element, 0); mainPageLayoutControl1.Refresh(); } }