Example #1
0
        //删除行
        private void tmiDeleteRow_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                //图层删除对应集合体
                int id = (int)row.Cells["ID"].Value;
                sLayer.DelFeature(id);

                //数据表删除对应行
                dataGridView1.Rows.Remove(row);

                //触发委托事件
                FeatureBeenDeleted?.Invoke(this);
            }
            if (!BeenEdit)
            {
                BeenEdit = true;
            }
        }
Example #2
0
        //取消编辑
        private void tmiCancelEdit_Click(object sender, EventArgs e)
        {
            //图层恢复
            sLayer.Features      = new List <Geometry>(OriginalLayer.Features);
            sLayer.Table         = OriginalLayer.Table.Copy();
            sLayer.SelectedItems = new List <int>(OriginalLayer.SelectedItems);
            sLayer.RefreshBox();

            //属性表恢复
            sTable = sLayer.Table.Copy();
            dataGridView1.DataSource = sTable;
            dataGridView1.Refresh();

            //刷新mapcontrol
            FeatureBeenDeleted?.Invoke(this);

            if (BeenEdit)
            {
                BeenEdit = false;
            }
        }