コード例 #1
0
        public void CreateADrawableObject_FillRectangleDrawer_Test()
        {
            DrawableFactory target = new DrawableFactory();

            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();
            drawingFeatures.DrawingState = DrawingState.DrawFilledRectangle;

            Point startPoint = new Point();

            ADrawable actual;
            actual = target.CreateADrawableObject(drawingFeatures, startPoint);

            Assert.IsTrue(actual is FillRectangleDrawer);
        }
コード例 #2
0
ファイル: DrawingModule.cs プロジェクト: mgorski-zlatan/Paint
        private void LeftMouseButton_Down(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                DrawableFactory drawableFactory = new DrawableFactory();

                Point currentPoint = e.Location;

                _currentDrawer = drawableFactory.CreateADrawableObject(_drawingFeatures, currentPoint);

                _currentDrawer.SetPoints(_previousPoint, currentPoint);

                _currentDrawer.Draw();

                _drawingFeatures.PaintingArea.Refresh();

                _drawingFeatures.DrawingHistory.History.Push(_currentDrawer);
            }

            _previousPoint = e.Location;
        }