桌面GIS

按MapGIS 10.5 Objects 二次开发演示做完,没有任何显示

Bug反馈
bug
头像
发布时间:2024-01-21 14:26:51
14341
33
2

按MapGIS 10.5 Objects 二次开发演示做完,没有任何显示,

Form1.cs代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using MapGIS.GeoMap;

using MapGIS.GISControl;


namespace zfmapgis

{

    public partial class Form1 : Form

    {

        //定义地图显示控件

        MapControl mapCtrl = null;

        //地图文档对象

        Document doc = null;

        //地图对象

        Map map = null;


        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender,EventArgs e)

        {

            //实例化地图显示控件

            mapCtrl = new MapControl();

            //设置地图显示控件的显示模式

            mapCtrl.Dock = DockStyle.Fill;

            //添加地图显示控件

            this.panel1.Controls.Add(this.mapCtrl);


            //打开指定地图文档

            doc = new Document();

            if(doc.Open (@"E:\Program Files\MapGIS 10\Sample\地图文档.mapx") > 0)

            {

                //获取第一个地图

                map = doc.GetMaps().GetMap(0);

                if (map!=null)

                {

                    //显示地图

                    this.mapCtrl.ActiveMap = map;

                    //复位窗口

                    this.mapCtrl.Restore();

                }

                else

                {

                    MessageBox.Show("当前地图文档无地图数据");

                    return;

                }

            }

            else

            {

                MessageBox.Show("打开失败!");

            }

        }

    }

}



App.config代码如下:

<?xml version="1.0"?>

<configuration>

  <startup useLegacyV2RuntimeActivationPolicy ="true">

    <supportedRuntime version ="v4.0"/>

  </startup>

</configuration>


Form1.Designer.cs代码如下:

namespace zfmapgis

{

    partial class Form1

    {

        /// <summary>

        /// 必需的设计器变量。

        /// </summary>

        private System.ComponentModel.IContainer components = null;


        /// <summary>

        /// 清理所有正在使用的资源。

        /// </summary>

        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }


        #region Windows 窗体设计器生成的代码


        /// <summary>

        /// 设计器支持所需的方法 - 不要修改

        /// 使用代码编辑器修改此方法的内容。

        /// </summary>

        private void InitializeComponent()

        {

            this.panel1 = new System.Windows.Forms.Panel();

            this.SuspendLayout();

            // 

            // panel1

            // 

            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;

            this.panel1.Location = new System.Drawing.Point(0, 0);

            this.panel1.Name = "panel1";

            this.panel1.Size = new System.Drawing.Size(800, 232);

            this.panel1.TabIndex = 0;

            // 

            // Form1

            // 

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(800, 450);

            this.Controls.Add(this.panel1);

            this.Name = "Form1";

            this.Text = "Form1";

            this.ResumeLayout(false);


        }


        #endregion


        private System.Windows.Forms.Panel panel1;

    }

}



Program.cs代码如下:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace zfmapgis

{

    static class Program

    {

        /// <summary>

        /// 应用程序的主入口点。

        /// </summary>

        [STAThread]

        static void Main()

        {

            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new Form1());

        }

    }

}


点击“开始调试”后,没有显示界面出现,输出信息如下:

image.png

评论区
头像
发布时间:2024-01-26 20:37:24
回复
#21楼
头像
发布时间:2024-01-26 15:55:18
#19楼
头像
发布时间:2024-01-27 14:13:54
回复
#22楼
头像
发布时间:2024-01-26 15:55:18
#19楼
头像
发布时间:2024-01-29 09:32:41
回复
#23楼
头像
发布时间:2024-01-29 12:15:39
回复
#24楼
头像
发布时间:2024-01-29 15:11:49
回复
#25楼
头像
发布时间:2024-01-29 12:15:39
#24楼
头像
发布时间:2024-01-29 15:15:51
回复
#26楼
头像
发布时间:2024-01-29 22:39:34
回复
#27楼
头像
发布时间:2024-01-29 15:11:49
#25楼
头像
发布时间:2024-01-29 22:48:51
回复
#28楼
头像
发布时间:2024-01-29 22:50:27
回复
#29楼
头像
发布时间:2024-01-29 23:33:34
回复
#30楼
头像
发布时间:2024-01-30 10:03:17
回复
#31楼
头像
发布时间:2024-01-29 23:33:34
#30楼
头像
发布时间:2024-01-30 15:07:26
回复
#32楼
头像
发布时间:2024-01-31 16:00:35
回复
#33楼
头像
发布时间:2024-01-30 10:03:17
#31楼
  • 确定
  • 到第
发布评论