示例#1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.isDrawing    = false;
            this.currentShape = null;

            if (currentButton != null)
            {
                currentButton.Checked = false;
            }

            currentButton       = arrowButton;
            arrowButton.Checked = true;
        }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.isDrawing = false;
            this.currentShape = null;

            if (currentButton != null)
                currentButton.Checked = false;

            currentButton = arrowButton;
            arrowButton.Checked = true;
        }
示例#3
0
        private void renderControl_MouseDown(object sender, MouseEventArgs e)
        {
            if (!isDrawing)
            {
                return;
            }

            isDragging   = true;
            startPoint.X = e.X;
            startPoint.Y = e.Y;
            endPoint     = startPoint;

            switch (currentShapeType)
            {
            case Shape.Line:
                currentShape = new LineShape(this, startPoint, startPoint, currentStrokeSize, currentBrushIndex);
                drawingShapes.Add(currentShape);
                break;

            case Shape.Bitmap:
                currentShape = new BitmapShape(
                    this,
                    new RectF(startPoint.X, startPoint.Y, startPoint.X + 5, startPoint.Y + 5),
                    currentBitmap, currentTransparency);
                drawingShapes.Add(currentShape);
                break;

            case Shape.RoundedRectangle:
                currentShape = new RoundRectangleShape(this,
                                                       new RoundedRect(
                                                           new RectF(startPoint.X, startPoint.Y, startPoint.X, startPoint.Y),
                                                           20f, 20f),
                                                       currentStrokeSize,
                                                       currentBrushIndex, fill);
                drawingShapes.Add(currentShape);
                break;

            case Shape.Rectangle:
                currentShape = new RectangleShape(this,
                                                  new RectF(startPoint.X, startPoint.Y, startPoint.X, startPoint.Y),
                                                  currentStrokeSize,
                                                  currentBrushIndex, fill);
                drawingShapes.Add(currentShape);
                break;

            case Shape.Ellipse:
                currentShape = new EllipseShape(this,
                                                new Ellipse(startPoint, 0, 0),
                                                currentStrokeSize,
                                                currentBrushIndex, fill);
                drawingShapes.Add(currentShape);
                break;

            case Shape.Text:
                currentShape = new TextShape(this, textDialog.TextLayout, startPoint, 100, 100, currentBrushIndex);
                drawingShapes.Add(currentShape);
                break;

            case Shape.Geometry:
                currentShape = new GeometryShape(this, startPoint, currentStrokeSize, currentBrushIndex, fill);
                drawingShapes.Add(currentShape);
                break;
            }
            Invalidate();
        }
        private void renderControl_MouseDown(object sender, MouseEventArgs e)
        {
            if (!isDrawing)
                return;

            isDragging = true;
            startPoint.X = e.X;
            startPoint.Y = e.Y;
            endPoint = startPoint;

            switch (currentShapeType)
            {
                case Shape.Line:
                    currentShape = new LineShape(this, startPoint, startPoint, currentStrokeSize, currentBrushIndex);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.Bitmap:
                    currentShape = new BitmapShape(
                            this,
                            new RectF(startPoint.X, startPoint.Y, startPoint.X + 5, startPoint.Y + 5),
                            currentBitmap, currentTransparency);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.RoundedRectangle:
                    currentShape = new RoundRectangleShape(this,
                            new RoundedRect(
                                new RectF(startPoint.X, startPoint.Y, startPoint.X, startPoint.Y),
                                20f, 20f),
                                currentStrokeSize,
                                currentBrushIndex, fill);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.Rectangle:
                    currentShape = new RectangleShape(this,
                                new RectF(startPoint.X, startPoint.Y, startPoint.X, startPoint.Y),
                                currentStrokeSize,
                                currentBrushIndex, fill);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.Ellipse:
                    currentShape = new EllipseShape(this,
                                new Ellipse(startPoint, 0, 0),
                                currentStrokeSize,
                                currentBrushIndex, fill);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.Text:
                    currentShape = new TextShape(this, textDialog.TextLayout, startPoint, 100, 100, currentBrushIndex);
                    drawingShapes.Add(currentShape);
                    break;
                case Shape.Geometry:
                    currentShape = new GeometryShape(this, startPoint, currentStrokeSize, currentBrushIndex, fill);
                    drawingShapes.Add(currentShape);
                    break;
            }
            Invalidate();
        }