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
  • 相关阅读:
    2015.2.27 UltraEdit中显示XML结构
    2015.1.31 DataGridView自动滚动到某行
    2015.1.15 利用函数实现将一行记录拆分成多行记录 (多年想要的效果)
    2015.1.15 利用Oracle函数返回表结果 重大技术进步!
    2015.1.15 利用Oracle函数插入表结构 Bulk collect into 不用循环,简洁高效
    2015.1.8 Left join 左连接
    2015.1.10 解决DataGridView SelectionChanged事件自动触发问题
    delphi 遍历窗口
    delphi 访问 protected 属性 哈哈
    clientdataset 读取excel 如果excel 文件不存在的时候 相应的gird 会不显示数据, 鼠标掠过 gird 格子 才会显示数据。 这是一个bug 哈哈
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15627622.html
Copyright © 2011-2022 走看看