您的位置:首页 > 编程语言 > C#

C#_状态栏,textbox动态变化

2013-08-27 17:44 183 查看

+

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using ESRI.ArcGIS.Carto;

using ESRI.ArcGIS.SystemUI;

using ESRI.ArcGIS.Controls;

namespace mxd3

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }   

        IMapDocument mMapDocument;

        private void LoadMapDocument()

        {

            mMapDocument = new MapDocumentClass();

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "(*.mxd)|*.mxd";

            openFileDialog1.Title = "打开地图文档";

            openFileDialog1.ShowDialog();

            string Path = openFileDialog1.FileName;

            if (axMapControl1.CheckMxFile(Path))

            {

                axMapControl1.LoadMxFile(Path);

            }

            axMapControl1.Refresh();

        }

        private void button1_Click_1(object sender, EventArgs e)

        {

            LoadMapDocument();

        }

        private void textBox1_KeyDown_1(object sender, KeyEventArgs e)

        {

            try

            {

                double Value = double.Parse(textBox1.Text);

                axMapControl1.MapScale = Value;

                axMapControl1.Refresh();            

            }

            catch

            {

                MessageBox.Show("请输入正确的比例尺");

            }

        }

      

        private void axMapControl1_OnMouseMove_1(object sender, IMapControlEvents2_OnMouseMoveEvent e)

        {        

           

            CoordinateLabel.Text = "当前坐标 X=" + e.mapX.ToString("#0.0000") + "Y=" + e.mapY.ToString("#0.0000") + " " + this.axMapControl1.MapUnits;//坐标加单位

        

        }   

       private void axMapControl1_OnViewRefreshed(object sender, IMapControlEvents2_OnViewRefreshedEvent e)

        {

            textBox1.Text = ((long)this.axMapControl1.MapScale).ToString();

        }

       private void button2_Click(object sender, EventArgs e)

       {

           ICommand Cmd = new ControlsMapFullExtentCommandClass();

           Cmd.OnCreate(this.axMapControl1.Object);

           Cmd.OnClick();

       }       

    }

}

 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: