Пример #1
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (bitmap == null)
                return;


            if (currentStroke != null)
            {
                if (currentStroke.drawingMode == Stroke.DrawingMode.RedArrow)
                {
                    currentStroke.points[currentStroke.points.Count - 1] = e.Location; // replace endpoint
                }
                else
                {
                    currentStroke.points.Add(e.Location);
                }
            }
            currentStroke = null;
            drawStrokes();
        }
Пример #2
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (bitmap == null)
                return;

            currentStroke = new Stroke();
            strokes.Add(currentStroke);
            currentStroke.points.Add(e.Location);

            if (e.Button == MouseButtons.Right)
            {
                // arrow
                currentStroke.drawingMode = Stroke.DrawingMode.RedArrow;
                currentStroke.points.Add(e.Location); // and the line's endpoint
            }
            else
            {
                if (this.toolStripComboBoxPenType.Text == "red arrow")
                {
                    // arrow
                    currentStroke.drawingMode = Stroke.DrawingMode.RedArrow;
                    currentStroke.points.Add(e.Location); // and the line's endpoint
                }
                else if (this.toolStripComboBoxPenType.Text == "red marker")
                {
                    currentStroke.drawingMode = Stroke.DrawingMode.RedMarker;
                }
                else
                {
                    currentStroke.drawingMode = Stroke.DrawingMode.YellowHighlighter;
                }
            }
        }