桌面GIS

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

Bug反馈
bug
头像
发布时间:2024-01-21 14:26:51
12804
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-22 09:38:37
回复
#1楼
头像
发布时间:2024-01-22 09:59:44
回复
#2楼
头像
发布时间:2024-01-26 11:00:18
回复
#3楼
头像
发布时间:2024-01-22 09:59:44
#2楼
头像
发布时间:2024-01-26 11:14:13
回复
#4楼
头像
发布时间:2024-01-26 11:15:51
回复
#5楼
头像
发布时间:2024-01-26 11:20:49
回复
#6楼
头像
发布时间:2024-01-26 11:00:18
#3楼
头像
发布时间:2024-01-26 11:22:56
回复
#7楼
头像
发布时间:2024-01-26 11:37:00
回复
#8楼
头像
发布时间:2024-01-26 11:53:37
回复
#9楼
头像
发布时间:2024-01-26 11:37:00
#8楼
头像
发布时间:2024-01-26 11:55:37
回复
#10楼
头像
发布时间:2024-01-26 11:53:37
#9楼
头像
发布时间:2024-01-26 11:56:44
回复
#11楼
头像
发布时间:2024-01-26 12:11:18
回复
#12楼
头像
发布时间:2024-01-26 12:20:03
回复
#13楼
头像
发布时间:2024-01-26 11:55:37
#10楼
头像
发布时间:2024-01-26 12:22:55
回复
#14楼
头像
发布时间:2024-01-26 12:49:14
回复
#15楼
头像
发布时间:2024-01-26 12:11:18
#12楼
头像
发布时间:2024-01-26 12:51:37
#16楼
头像
发布时间:2024-01-26 12:51:50
回复
#17楼
头像
发布时间:2024-01-26 12:49:14
#15楼
头像
发布时间:2024-01-26 14:38:25
回复
#18楼
头像
发布时间:2024-01-26 15:55:18
回复
#19楼
头像
发布时间:2024-01-26 20:35:47
#20楼
头像
发布时间:2024-01-26 14:38:25
#18楼
  • 确定
  • 到第
发布评论