zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    说话
    批处理程序判断命令返回结果 Virus
    摘抄:.NET垃圾回收和资源管理 Virus
    sharepoint:修改域账号密码和本机密码的代码和范例 Virus
    批处理中的for循环 Virus
    NHibernate学习总结:(一)NHibernate的使用和配置 Virus
    关于.NET大数据量大并发量的数据连接池管理 Virus
    爬网日志中的警告信息:文件达到最大下载次数,The file reached the maximum download limit. Check that the full text of the document can be meani Virus
    在批处理中运行.sql文件 Virus
    规划dll的目录 Virus
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15627622.html
Copyright © 2011-2022 走看看