using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;

namespace ArcMap
{
    public partial class FullScreen : Form
    {
        IEnvelope m_Envelope;
        public IEnvelope Envelope
        {
            set { m_Envelope = value; ; }
        }

        public FullScreen()
        {
            InitializeComponent();
        }
        public FullScreen(Form form)
        {
            
        }

        private void FullScreen_Load(object sender, EventArgs e)
        {
             
            IObjectCopy pObjectCopy = new ObjectCopyClass();

            //FrmMain为主窗体,在主窗体类中用一个AxMapControl类型的变量pMapCon
            //来存储主窗体的axMapControl控件           
            object pCopyFromMap = FrmMain.pMapCon.ActiveView.FocusMap;
            object pCopyToMap = pObjectCopy.Copy(pCopyFromMap);
            IMap pMap = pCopyToMap as IMap;
            this.axMapControl1.Map = pMap;
            this.TopMost = true;
            this.FormBorderStyle = FormBorderStyle.None;
            int pScreenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;  //显示器高度
            int pScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;    //显示器宽度
            this.Top = 0;
            this.Left = 0;
            this.Width = pScreenWidth;
            this.Height = pScreenHeight;
        }

        //右键点击也退出全屏界面
        private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
            if(e.button ==2)
            {
                this.Close();
            }
        }

        //放大
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //this .axMapControl1 =FrmMain.pMapCon  ;
            ESRI.ArcGIS.SystemUI.ITool tool = new ControlsMapZoomInToolClass();
            ESRI.ArcGIS.SystemUI.ICommand cmd = tool as ESRI.ArcGIS.SystemUI.ICommand;
            cmd.OnCreate(this.axMapControl1.Object);
            this.axMapControl1.CurrentTool = tool;
        }

        //缩小
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ESRI.ArcGIS.SystemUI.ITool tool = new ControlsMapZoomOutToolClass();
            ESRI.ArcGIS.SystemUI.ICommand cmd = tool as ESRI.ArcGIS.SystemUI.ICommand;
            cmd.OnCreate(this.axMapControl1.Object);
            this.axMapControl1.CurrentTool = tool;
        }

        //漫游
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ESRI.ArcGIS.SystemUI.ITool tool = new ControlsMapPanToolClass();
            ESRI.ArcGIS.SystemUI.ICommand cmd = tool as ESRI.ArcGIS.SystemUI.ICommand;
            cmd.OnCreate(this.axMapControl1.Object);
            this.axMapControl1.CurrentTool = tool;
        }

        //退出
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }
    }
}