//设置单位为厘米
axPageLayoutControl3.PageLayout.Page.Units = esriUnits.esriCentimeters;
IGraphicsContainer graphicsContainer = axPageLayoutControl3.PageLayout as IGraphicsContainer;
//获取图框
IMapFrame mf = graphicsContainer.FindFrame(axPageLayoutControl3.ActiveView.FocusMap) as IMapFrame;
//设置图框范围
IEnvelope en1 = new EnvelopeClass();
en1.PutCoords(0,0,10,10);
IElement ele = mf as IElement;
ele.Geometry = en1;
ITextElement pTextElement = new TextElementClass();
pTextElement.Text = "国家测绘地理信息局";
ITextSymbol pTextSymbol = new TextSymbolClass();
IRgbColor redColor = new RgbColorClass();
redColor.Red = 0;
redColor.Green = 0;
redColor.Blue = 0;
redColor.UseWindowsDithering = true;
pTextSymbol.Color = redColor as IColor;
pTextSymbol.Size = 32;
pTextElement.Symbol = pTextSymbol;
//字号到厘米换算 一个字的宽度=size/72.0*2.54
//说明:
//字号 1约等于1/72英寸, 1英寸=2.54厘米
IPoint pt
ArcObjects操作PageLayoutControl中元素位置,以图框、ITextSymbol为例
最新推荐文章于 2021-04-16 19:49:10 发布