• PIE SDK图片元素的绘制


     

    1. 功能简介

        在数据的处理中会用到图片元素的绘制,利用IPictureElement图片元素接口进行绘制,目前PIE SDK支持IPictureElement元素接口的绘制,下面对图片元素的绘制进行介绍。

    2. 功能实现说明

    2.1.1. 实现思路及原理说明

    第一步

    设置图片的Geometry信息

    第二步

    获取或设置图片的信息

    第三步

    添加绘制元素

    2.1.2. 核心接口与方法

    接口/类

    方法/属性

    说明

    IGraphicsContainer

    AddElement(IElement element)

    添加元素

     

    IPictureElement

    SetImage()

    设置图片

    SetVisibility()

    设置可见性

    Geometry属性

    获取或设置Geometry

    2.1.3. 示例代码

    项目路径

    百度云盘地址下/PIE示例程序/08元素绘制/05图片元素的绘制

    视频路径

    百度云盘地址下/PIE视频教程/08元素绘制/05图片元素的绘制.avi

    示例代码

     1         /// <summary>
     2         /// 图片元素的绘制
     3         /// </summary>
     4         /// <param name="sender"></param>
     5         /// <param name="e"></param>
     6         private void toolStripButton_DrawPicElemnet_Click(object sender, EventArgs e)
     7         {
     8             //1.设置空间位置
     9             IPointCollection polygon = new PIE.Geometry.Polygon();
    10             polygon.AddPoint(100, 100);
    11             polygon.AddPoint(100, 200);
    12             polygon.AddPoint(200, 200);
    13             polygon.AddPoint(200, 100);
    14             polygon.AddPoint(100, 100);
    15 
    16             //2.得到图片
    17             OpenFileDialog openFileDialog = new OpenFileDialog();
    18             openFileDialog.Filter = "Picture File|*.bmp";
    19             if (openFileDialog.ShowDialog() != DialogResult.OK) return;
    20 
    21             //3.设置元素的显示
    22             IPictureElement picElement = new PictureElement();
    23             picElement.SetImage(openFileDialog.FileName);
    24             picElement.SetVisibility(true);
    25 
    26             //4.在地图控件中显示图片元素
    27             picElement.Geometry = polygon as IGeometry;            mapControlMain.ActiveView.GraphicsContainer.AddElement(picElement);            mapControlMain.PartialRefresh(ViewDrawPhaseType.ViewAll);
    28         }   
    View Code 

    2.1.4. 示例截图

  • 相关阅读:
    Oracle ASH报告生成和性能分析
    Oracle AWR报告生成和性能分析
    oracle和mysql批量合并对比
    Oracle
    Delphi
    Delphi
    Delphi
    Delphi
    Delphi
    Delphi
  • 原文地址:https://www.cnblogs.com/PIESat/p/10172186.html
Copyright © 2020-2023  润新知