首页 / 浏览问题 / 组件GIS / 问题详情
Action.VertexEdit设置不了
216EXP 2019年07月24日

开发环境:SuperMap9.1.1 dotnet(x64版本)

问题:创建MapControl,其Action的默认状态为Select2,

通过SuperMap.UI.Action.VertexEdit 更改不了mapcontrol的默认状态,仍然为Select2.

对比:组件示例,交互式编辑中可以切换点、线、面和文本等4种状态,

示例demo:

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 SuperMap.UI;

namespace test
{
    public partial class Form1 : Form
    {
        private MapControl mapControl;

        public Form1()
        {
            InitializeComponent();
            InitializeMapControl();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // mapControl.Action = SuperMap.UI.Action.Null;
            mapControl.Action = SuperMap.UI.Action.VertexEdit;

            MessageBox.Show(mapControl.Action.ToString());
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        //public Workspace SubWorkspace { get; set; }
        /// <summary>
        /// 初始化地图控件
        /// </summary>
        private void InitializeMapControl()
        {
            this.mapControl = new SuperMap.UI.MapControl();

            this.Controls.Add(mapControl);
            // 
            // mapControl
            // 
            //this.mapControl.Action = SuperMap.UI.Action.Select2;
            // this.mapControl.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            // this.mapControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.mapControl.Dock = System.Windows.Forms.DockStyle.Fill;
            //this.mapControl.InteractionMode = SuperMap.UI.InteractionMode.Default;
            //this.mapControl.IsActionPrior = true;

            //this.mapControl.IsCursorCustomized = true;

            //this.mapControl.IsGlobalBrowsing = false;
            //this.mapControl.IsWaitCursorEnabled = true;
            //this.mapControl.Location = new System.Drawing.Point(3, 3);
            //this.mapControl.Margin = new System.Windows.Forms.Padding(56, 24, 56, 24);
            //this.mapControl.MarginPanEnabled = true;
            //this.mapControl.MarginPanPercent = 0.5D;
            //this.mapControl.Name = "mapControl";
            ////this.mapControl.RefreshAtTracked = true;
            ////this.mapControl.RefreshInInvalidArea = false;
            //this.mapControl.RollingWheelWithoutDelay = false;
            ////this.mapControl.SelectionMode = SuperMap.UI.SelectionMode.ContainInnerPoint;
            //this.mapControl.SelectionPixelTolerance = 0;
            //this.mapControl.Size = new System.Drawing.Size(584, 413);
            //this.mapControl.TabIndex = 0;
            //this.mapControl.TrackMode = SuperMap.UI.TrackMode.Edit;
            //this.mapControl.DragDrop += new System.Windows.Forms.DragEventHandler(this.mapControl_DragDrop);
            //this.mapControl.DragOver += new System.Windows.Forms.DragEventHandler(this.mapControl_DragOver);

            //设置地图显示比例尺
            //this.mapControl.Map.IsVisibleScalesEnabled = true;
            //this.mapControl.Map.Drawn += Map_Drawn;
        }
    }
}

1个回答

您好,你那边开启图层可编辑了吗,要先开启图层可编辑才可以进行设置,代码为layer.IsEditable=true;
2,432EXP 2019年07月24日
...