Пример #1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            switch (this.DrawingType)
            {
            case DrawingCanavsGeometries.Ellipse:
            {
                this.isDrawing = false;
                Rectangle r = this.startMousePosition.MakeRectangle(this.currentMousePosition);
                this.NotifyDrawCompleted(GeometryEllipse.FromRectangle(r));
                break;
            }

            case DrawingCanavsGeometries.Rectangle:
            {
                this.isDrawing = false;
                Rectangle r = this.startMousePosition.MakeRectangle(this.currentMousePosition);
                this.NotifyDrawCompleted(GeometryRectangle.FromRectangle(r));
                break;
            }

            case DrawingCanavsGeometries.Polygon:
            {
                break;
            }

            default:
                break;
            }
        }
Пример #2
0
 private void DrawRectangle(Graphics g, GeometryRectangle rectangle)
 {
     g.FillRectangle(this.drawingOptions.PolygonBackgroundBrush, rectangle.OffsetX, rectangle.OffsetY, rectangle.Width, rectangle.Height);
     g.DrawRectangle(this.drawingOptions.PolygonBorderPen, rectangle.OffsetX, rectangle.OffsetY, rectangle.Width, rectangle.Height);
 }