Esempio n. 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;
            }
        }
Esempio n. 2
0
        // 4. 下面的受保护虚方法负责通知事件的登记对象

        /// <summary>
        /// 触发事件的执行
        /// 此函数将被DrawPenel中的deleteLine函数调用
        /// </summary>
        /// <param name="e"></param>
        internal virtual void OnDeleteLine(DeleteLineEventArgs e)
        {
            // 有对象登记事件吗?
            if (DeleteLineEvent != null)
            {
                // 如果有,则通知委托链表上的所有对象
                DeleteLineEvent(this, e);
            }
        }