コード例 #1
0
ファイル: BucketTool.cs プロジェクト: DavidJuul/aatg-paint
        public override void OnMouseDown(object sender, MouseEventArgs e)
        {
            CanvasView canvasView = sender as CanvasView;

            Canvas canvas = canvasView.Canvas;

            canvas.Fill(Color);
        }
コード例 #2
0
        public Canvas()
        {
            View = new CanvasView(this);

            Bitmap = new Bitmap(1600, 800);
            CreateGraphics();
            _graphics.Clear(Color.White);
            SaveState();
        }
コード例 #3
0
ファイル: BrushTool.cs プロジェクト: DavidJuul/aatg-paint
        public override void OnMouseDown(object sender, MouseEventArgs e)
        {
            _drawing = true;

            CanvasView canvasView = sender as CanvasView;

            _previousPoint = canvasView.GetBitmapLocation(e.Location);

            Canvas canvas = canvasView.Canvas;

            canvas.FillCircle(_pen, _previousPoint);
        }
コード例 #4
0
ファイル: BrushTool.cs プロジェクト: DavidJuul/aatg-paint
        public override void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_drawing)
            {
                CanvasView canvasView   = sender as CanvasView;
                Point      currentPoint = canvasView.GetBitmapLocation(e.Location);

                Canvas canvas = canvasView.Canvas;
                canvas.DrawLine(_pen, _previousPoint, currentPoint);

                _previousPoint = currentPoint;
            }
        }
コード例 #5
0
        public override void OnMouseDown(object sender, MouseEventArgs e)
        {
            TextDialog   textDialog   = new TextDialog();
            DialogResult dialogResult = textDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                CanvasView canvasView = sender as CanvasView;
                _point = canvasView.GetBitmapLocation(e.Location);

                Canvas canvas = canvasView.Canvas;
                Font   font   = new Font(_fontFamily, Size);

                canvas.DrawText(textDialog.Text, font, Color, _point);
            }
        }