使用C#绘制MO中地图的图例

这是一个使用C#编程语言实现地图图例绘制的示例,通过创建自定义用户控件LegendSingle来展示地图各层的符号。代码包括初始化图例、绘制点、线和面的图例以及处理滚动条事件。
摘要由CSDN通过智能技术生成

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;


namespace Gissky.Geography.Legend
{
/// <summary>
/// Legend 的摘要说明。//code by aji 2004-10-01
/// </summary>
public class LegendSingle : System.Windows.Forms.UserControl
{
  private ESRI.MapObjects2.Core.AxMap m_MapObj;
  System.Drawing.Bitmap bmp ;
  System.Drawing.Graphics g ;
  int iTextDrawX;
  private System.Windows.Forms.VScrollBar ScrollBarv;
  private System.Windows.Forms.HScrollBar ScrollBarh;
  private System.Windows.Forms.PictureBox LegendPicture;
  private int bmpHeight;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;
  public LegendSingle()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();


   //
   // TOD 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }


  public LegendSingle(ESRI.MapObjects2.Core.AxMap obj)
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();


   //
   // TOD 在 InitializeComponent 调用后添加任何构造函数代码
   //
   this.m_MapObj = obj;
  
  }


  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }


  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.LegendPicture = new System.Windows.Forms.PictureBox();
   this.ScrollBarv = new System.Windows.Forms.VScrollBar();
   this.ScrollBarh = new System.Windows.Forms.HScrollBar();
   this.SuspendLayout();
   //
   // LegendPicture
   //
   this.LegendPicture.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    | System.Windows.Forms.AnchorStyles.Right)));
   this.LegendPicture.BackColor = System.Drawing.SystemColors.HighlightText;
   this.LegendPicture.Location = new System.Drawing.Point(0, 0);
   this.LegendPicture.Name = "LegendPicture";
   this.LegendPicture.Size = new System.Drawing.Size(200, 300);
   this.LegendPicture.TabIndex = 3;
   this.LegendPicture.TabStop = false;
   //
   // ScrollBarv
   //
   this.ScrollBarv.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    | System.Windows.Forms.AnchorStyles.Right)));
   this.ScrollBarv.Location = new System.Drawing.Point(184, 0);
   this.ScrollBarv.Name = "ScrollBarv";

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值