• ArcEngine实现pagelayout中文本元素的属性对话框


    来自:https://www.cnblogs.com/caodajieup/archive/2011/09/28/2193891.html
    ArcEngine实现pagelayout中文本元素的属性对话框 效果如上图,有点难看 源码如下
    public partial class Properties : Form { IPageLayoutControlDefault pPageLayout = null; ITextElement pTextElement = null; ITextSymbol pTextSymbol = null; ICharacterOrientation pCharacterOrientation = null; IGraphicsContainer pGraphicsContainer = null; public Properties(IPageLayoutControlDefault pageLayout,ITextElement textElement) { InitializeComponent(); pPageLayout = pageLayout; pTextElement = textElement; pTextSymbol = pTextElement.Symbol; pGraphicsContainer = pageLayout.ActiveView.GraphicsContainer; } private void Properties_Load(object sender, EventArgs e) { textBox1.Text = pTextElement.Text; textBox2.Text = pTextSymbol.Font.Name + " " + pTextSymbol.Font.Size.ToString(); numericUpDown1.Value = (decimal)(pTextSymbol.Angle); checkB.Checked = pTextSymbol.Font.Bold; checkU.Checked = pTextSymbol.Font.Underline; checkI.Checked = pTextSymbol.Font.Italic; pCharacterOrientation = pTextSymbol as ICharacterOrientation; checkO.Checked = pCharacterOrientation.CJKCharactersRotation; } private void buttonChange_Click(object sender, EventArgs e) //更改字体 { FontDialog fontDialog = new FontDialog(); if (fontDialog.ShowDialog() == DialogResult.OK) { Font selectFont = fontDialog.Font; textBox2.Text = selectFont.Name + " " + selectFont.Size.ToString(); stdole.IFontDisp pFont = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont(selectFont) as stdole.IFontDisp; pTextSymbol.Font = pFont; } } private void buttonOK_Click(object sender, EventArgs e) //确定 { pCharacterOrientation = pTextSymbol as ICharacterOrientation; pCharacterOrientation.CJKCharactersRotation = checkO.Checked; stdole.IFontDisp pFont = pTextSymbol.Font; pFont.Bold = checkB.Checked; pFont.Underline = checkU.Checked; pFont.Italic = checkI.Checked; pTextSymbol.Font = pFont; pTextElement.Text = textBox1.Text; pTextElement.Symbol = pTextSymbol; pGraphicsContainer.UpdateElement(pTextElement as IElement); pPageLayout.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); this.Close(); this.Dispose(); } private void buttonCancel_Click(object sender, EventArgs e) //取消 { this.Close(); this.Dispose(); } } 使用时要在主界面中的Pagelayout空间中编写双击事件,如下 private void axPageLayoutControl1_OnDoubleClick(object sender, IPageLayoutControlEvents_OnDoubleClickEvent e) { IElement pelement, selectElement = null; IGraphicsContainerSelect pGraphicsContainerSelect = pPageLayout.PageLayout as IGraphicsContainerSelect; IGraphicsContainer pGraphicsContainer = pPageLayout.PageLayout as IGraphicsContainer; pGraphicsContainer.Reset(); pelement = pGraphicsContainer.Next(); while (pelement != null) { if (pelement.HitTest(e.pageX, e.pageY, 0.1)) { if (pelement is ITextElement) { selectElement = pelement; } } pelement = pGraphicsContainer.Next(); } if (selectElement is ITextElement) { Properties propertiesForm = new Properties(pPageLayout, selectElement as ITextElement); propertiesForm.Visible = true; } } 没有做文本元素位置选择的功能,感觉那个作用作用不大,因为位置可以通过Select Element工具调整
    来自:https://www.cnblogs.com/caodajieup/archive/2011/09/28/2193891.html
  • 相关阅读:
    Docker宿主机登陆Container方法
    Get Docker for CentOS and Installing Docker
    CentOS7网络配置
    国内npm镜像源推荐及使用
    CentOS6.5源码安装python3.5.2
    阿里云SLB后Nginx、Tomcat获取真实IP
    MacOS清除管理员密码
    SVN-修改已提交的日志
    爬虫的初始和requests模块基础用法
    利用面向对象写的登录与注册
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15627622.html
Copyright © 2020-2023  润新知