コード例 #1
0
        private void TmpltDesignerControlPanel_DeleteLineEvent(object sender, DeleteLineEventArgs e)
        {
            foreach (NeighbourRect rect in e.NeighbourRectList)
            {
            }
            ///提示用户保留每对矩形的哪个数据
            MergeRectForm mergeRectForm = new MergeRectForm(e.NeighbourRectList, _backImg);

            if (mergeRectForm.ShowDialog() == DialogResult.OK)
            {
                e.Cancel = false;
                ///执行删除操作,本应该在command.Execute里执行,但因为需要和mergeRectForm交互,便提前在此操作
                for (int i = 0; i < e.NeighbourRectList.Count; i++)
                {
                    if (((RadioButton)mergeRectForm.GroupBoxList[i].Controls[0]).Checked)
                    {
                        e.HoldedRectList.Add(e.NeighbourRectList[i].FirstRect);
                        e.RemovedRectList.Add(e.NeighbourRectList[i].SecondRect);
                    }
                    else
                    {
                        e.HoldedRectList.Add(e.NeighbourRectList[i].SecondRect);
                        e.RemovedRectList.Add(e.NeighbourRectList[i].FirstRect);
                    }
                }
                this.Invalidate();
            }
            else
            {
                e.Cancel = true;
            }
        }
コード例 #2
0
        void TmpltDesignerControlPanel_MergeRectEvent(object sender, MergeRectEventArgs e)
        {
            MergeRectForm mergeRectForm = new MergeRectForm(e.SelectedRects, _backImg);

            if (mergeRectForm.ShowDialog() == DialogResult.OK)
            {
                e.Cancel = false;
                ///执行删除操作,本应该在command.Execute里执行,但因为需要和mergeRectForm交互,便提前在此操作
                e.HoldRect = mergeRectForm.HoldRect;// CommonFuns.GetChedIndex(mergeRectForm.GroupBoxList[0]);
                this.Invalidate();
            }
            else
            {
                e.Cancel = true;
            }
        }