예제 #1
0
        public int catchPointIndex = -1;                                               //捕捉热点的索引

        public override void mouseDown(object sender, MouseEventArgs e, CADFrame objC) //重写鼠标的按下
        {
            catchPointIndex = -1;                                                      //重置捕捉热点的索引
            if (this.getOperShape() != null)
            {
                this.getOperShape().setUnSelected();                         //清除前操作对象中选中的状态
            }
            ArrayList allShapes  = this.getRefCADPanel().getCurrentShapes(); //得到画板上的所有图形
            int       catchPoint = -1;
            int       i          = 0;

            for (; i < allShapes.Count; i++)                                                   //对每个图形进行捕捉测试
            {
                catchPoint = ((BaseShape)allShapes[i]).catchShapPoint(this.getNewMovePoint()); //捕捉集合中的一个图形
                if (catchPoint > -1)
                {
                    break;                 //捕获到后,跳出循环
                }
            }
            if (catchPoint > -1)
            {
                catchPointIndex = catchPoint;                 //捕获到后,将临时的热点设置到工具属性中
                ((BaseShape)allShapes[i]).setSelected();      //设置捕捉到的图形为选中状态
                this.setOperShape(((BaseShape)allShapes[i])); //把选中的图形设定到本类的操作图形的状态中
            }
            this.getRefCADPanel().Refresh();                  //刷新画板
        }
예제 #2
0
 public override void mouseDown(object sender, MouseEventArgs e, CADFrame objC)//重写线的鼠标按下
 {
     this.setOperShape(new LineShape());
     this.getOperShape().setP1(this.getDownPoint());
     this.getOperShape().penColor = objC.clr;
     this.getOperShape().penwidth = objC.lineWidth;
     this.getRefCADPanel().getCurrentShapes().Add(this.getOperShape());//
 }
예제 #3
0
 public void superMouseDown(object sender, MouseEventArgs e, CADFrame objCAD) //鼠标按下
 {
     this.setUpPoint(new Point(e.X, e.Y));                                    //鼠标的弹起点的设定
     this.setDownPoint(new Point(e.X, e.Y));                                  //鼠标按下点的设定
     this.setOldMovePoint(new Point(e.X, e.Y));                               //老的鼠标移动点的设定
     this.setNewMovePoint(new Point(e.X, e.Y));                               //新的鼠标移动点的设定
     this.setOldDragPoint(new Point(e.X, e.Y));                               //老的鼠标拖动点的设定
     this.setNewDragPoint(new Point(e.X, e.Y));                               //新的鼠标拖动点的设定
     this.mouseDown(sender, e, objCAD);                                       //鼠标按下的处理
 }
예제 #4
0
 public void setRefCADPanel(CADFrame refCADPanel)
 {
     this.refCADPanel = refCADPanel;
 }
예제 #5
0
 public abstract void mouseUp(object sender, MouseEventArgs e);                  //鼠标弹起的处理
 public abstract void mouseDown(object sender, MouseEventArgs e, CADFrame objC); //鼠标按下的处理
예제 #6
0
 public static Pen getPen(CADFrame objCAD)//得到画笔
 {
     return(new Pen(objCAD.clr, objCAD.lineWidth));
 }