public override void OnMouseDown(object sender, MouseEventArgs e) { CanvasView canvasView = sender as CanvasView; Canvas canvas = canvasView.Canvas; canvas.Fill(Color); }
public Canvas() { View = new CanvasView(this); Bitmap = new Bitmap(1600, 800); CreateGraphics(); _graphics.Clear(Color.White); SaveState(); }
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); }
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; } }
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); } }