public override void addTitles(string sTitle, string sSubTitle) { CSpatialSubs oSpatialSubs = new CSpatialSubs(); IMxDocument pMxDoc = (IMxDocument)ArcMap.Document; IGraphicsContainer pGC = (IGraphicsContainer)pMxDoc.PageLayout; ITextSymbol pTitleTextSym = null; ITextElement pTitleTextElem = null; ITextSymbol pSubTitleTextSym = null; ITextElement pSubTitleTextElem = null; try { // count line breaks in sTitle int iTitleLineBreaks = sTitle.Split(new string[] { "\r\n" }, StringSplitOptions.None).Length - 1; double dblXMin = 0; double dblXMax = 0; double dblYMin = 0; double dblYMax = 0; // do the title stuff dblXMin = SPrintConst.Title_XMin * base.XFactor; //(SPrintConst.MapFrame_XMax + SPrintConst.Title_XOffset) * base.XFactor; dblXMax = SPrintConst.Title_XMax * base.XFactor; //(SPrintConst.Neatline_XMax * base.XFactor); //dblYMin = (SPrintConst.Subtitle_YMax + SPrintConst.Title_XOffset) * base.YFactor; dblYMin = SPrintConst.Title_YMin * base.YFactor; //(SPrintConst.Title_YMin * base.YFactor); dblYMax = SPrintConst.Title_YMax * base.YFactor; //SPrintConst.Title_YMax * base.YFactor; if (sTitle.Length > 0) { pTitleTextSym = oSpatialSubs.createTextSymbol(0, 0, 0, 16 * base.XFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial"); pTitleTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pTitleTextSym, dblXMin, dblXMax, dblYMin, dblYMax, sTitle); //move the title right where we want it oSpatialSubs.moveElementToXMinYmin(pTitleTextElem as IElement, dblXMin, dblYMax); } // do the subtitle stuff dblXMin = SPrintConst.Subtitle_XMin * base.XFactor; //(SPrintConst.MapFrame_XMax + SPrintConst.Title_XOffset) * base.XFactor; dblXMax = SPrintConst.Subtitle_XMax * base.XFactor; //(SPrintConst.Neatline_XMax * base.XFactor); //dblYMin = (SPrintConst.Legend_YMax + SPrintConst.Title_XOffset) * base.YFactor; dblYMin = SPrintConst.Subtitle_YMin * base.YFactor; //(SPrintConst.Title_YMin - .20) * base.YFactor; dblYMax = SPrintConst.Subtitle_YMax * base.YFactor; //SPrintConst.Subtitle_YMax * base.YFactor; if (sSubTitle.Length > 0) { if (iTitleLineBreaks > 0) { dblYMin -= (.39 * base.YFactor); } pSubTitleTextSym = oSpatialSubs.createTextSymbol(108, 108, 108, 9 * base.XFactor, esriTextHorizontalAlignment.esriTHALeft, esriTextVerticalAlignment.esriTVATop, "Arial"); pSubTitleTextElem = oSpatialSubs.addTextToGraphicsContainer(pGC, pSubTitleTextSym, dblXMin, dblXMax, dblYMin, dblYMax, sSubTitle); //move the title right where we want it oSpatialSubs.moveElementToXMinYmin(pSubTitleTextElem as IElement, dblXMin, dblYMin); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Errors: CLandscapeLayout:addTitles()\r\n" + ex.Message, "Errors occurred", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } finally { oSpatialSubs.Dispose(); pMxDoc = null; pGC = null; pTitleTextSym = null; pTitleTextElem = null; pSubTitleTextSym = null; pSubTitleTextElem = null; } }