Exemple #1
0
 private void previewBox_MouseUp(object sender, MouseEventArgs e)
 {
     if (this.currentDicomElement != null)
     {
         if (this.mainForm.isTextStarted)
         {
             selecting = false;
             this.mainForm.annotateTextForm.Clear();
             if (this.mainForm.annotateTextForm.ShowDialog() == DialogResult.OK)
             {
                 commandManager.Execute(
                     new AddAnnotationCommand(annotationManager,
                         new TextAnnotation(this.mainForm.annotateTextForm.GetAnnotationText(),
                     e.X, e.Y, this.mainForm.currentColor, this.mainForm.annotateTextForm.GetFont())));
             }
         }
         else if (this.mainForm.isFreehandStarted)
         {
             // insert freehandannotation
             selecting = false;
             commandManager.Execute(new AddAnnotationCommand(annotationManager, currentFreeHandAnnotation));
             currentFreeHandAnnotation = null;
         }
         else
         {
             selecting = false;
         }
     }
 }
Exemple #2
0
        private void previewBox_MouseMove(object sender, MouseEventArgs e)
        {
            if (this.currentDicomElement != null)
            {
                if (this.mainForm.isFreehandStarted)
                {
                    selecting = false;
                    if (System.Windows.Forms.MouseButtons.Left == e.Button)
                    {
                        if (currentFreeHandAnnotation == null)
                        {
                            currentFreeHandAnnotation = new FreeHandAnnotation(this.mainForm.currentColor);
                            currentFreeHandAnnotation.Width = this.mainForm.BrushSize;
                            annotationManager.AddAnnotation(currentFreeHandAnnotation);
                        }
                        currentFreeHandAnnotation.AddPoint(e.X, e.Y);

                        Bitmap bmp = (Bitmap)previewBox.Image;
                        currentFreeHandAnnotation.DrawLastSegment(bmp);
                        previewBox.Invalidate();
                    }
                }
                else
                {
                    if (selecting && selectToolActive)
                    {
                        selection.Width = e.X - selection.X;
                        selection.Height = e.Y - selection.Y;
                        if ((selection.X + selection.Width) > this.visibleImage.Width)
                            selection.Width = this.visibleImage.Width - selection.X;

                        if ((selection.Y + selection.Height) > this.visibleImage.Height)
                            selection.Height = this.visibleImage.Height - selection.Y;

                        this.previewBox.Refresh();
                    }
                    else if (selecting && rulerToolActive)
                    {
                        endPoint = new Point(e.X, e.Y);
                        this.previewBox.Refresh();
                    }
                }
            }
        }