예제 #1
0
        //Mouse button up on PaintBox
        private void Canvas_MouseUp(object sender, MouseEventArgs e)
        {
            btn_down = false;

            switch (mode)
            {
            case eMode.shapeLine:
                CurrentEditor.AddLine(line_beg, new Point(e.X, e.Y));
                break;

            case eMode.shapeCircle:
                CurrentEditor.AddEllipse(line_beg, new Point(e.X, e.Y));
                break;

            case eMode.shapeRect:
                CurrentEditor.AddRect(line_beg, new Point(e.X, e.Y));
                break;

            case eMode.modeSelect:
                //multiselect
                if (!this.ctrl)
                {
                    lvShapes.SelectedIndices.Clear();
                }

                //near shape
                int val = CurrentEditor.GetNearShape(new Point(e.X, e.Y));
                if (val != -1)
                {
                    lvShapes.SelectedIndices.Add(val);
                }
                //then @SelectFigures(int[] indexes) called
                break;
            }
        }