Ejemplo n.º 1
0
        //关闭窗口时保存
        private void Form3_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (tmiEdit.Enabled == true)
            {
                SaveRequestForm savefrm = new SaveRequestForm();
                if (savefrm.ShowDialog(this) == DialogResult.OK)
                {
                    sLayer.Table = sTable.Copy();
                }
                else
                {
                    //图层恢复
                    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();
                }
                if (BeenEdit)
                {
                    BeenEdit = false;
                }
            }
        }
Ejemplo n.º 2
0
        //结束编辑
        private void tmiStopEdit_Click(object sender, EventArgs e)
        {
            tmiEdit.Enabled        = false;
            dataGridView1.ReadOnly = true;
            sLayer.IsEdit          = false;

            //用户做了编辑
            if (BeenEdit)
            {
                SaveRequestForm savefrm = new SaveRequestForm();
                if (savefrm.ShowDialog(this) == DialogResult.OK)
                {
                    sLayer.Table = sTable.Copy();
                }
                else
                {
                    //图层恢复
                    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();
                }

                BeenEdit = false;
            }
        }