예제 #1
0
    /// <summary>
    /// <see cref="VectorGraphics.Canvas.PictureModifiable.ShapeDoubleClick"/> event handler of the
    ///   <see cref="VectorGraphics.Canvas.PictureModifiable"/> <see cref="designPicture"/>.
    ///   Calls the detailed stimuli dialogs for the clicked element.
    /// </summary>
    /// <param name="sender">
    /// Source of the event.
    /// </param>
    /// <param name="e">
    /// A <see cref="ShapeEventArgs"/> with the selected shape.
    /// </param>
    private void PicPreviewShapeDoubleClick(object sender, ShapeEventArgs e)
    {
      if (e.Shape is VGText)
      {
        var text = (VGText)e.Shape;
        var dlg = new TextDialog { NewText = text };
        if (dlg.ShowDialog() == DialogResult.OK)
        {
          VGText modifiedText = dlg.NewText;
          ((VGText)this.designPicture.SelectedElement).StringToDraw = modifiedText.StringToDraw;
          ((VGText)this.designPicture.SelectedElement).Alignment = modifiedText.Alignment;
          ((VGText)this.designPicture.SelectedElement).TextFont = modifiedText.TextFont;
          ((VGText)this.designPicture.SelectedElement).TextFontColor = modifiedText.TextFontColor;
          ((VGText)this.designPicture.SelectedElement).LineSpacing = modifiedText.LineSpacing;
          this.UpdateSelectedElementAndPropertyControl(modifiedText);
        }
      }
      else if (e.Shape is VGRichText)
      {
        var text = (VGRichText)e.Shape;
        var dlg = new RichTextDialog();
        dlg.NewRichText = text;
        if (dlg.ShowDialog() == DialogResult.OK)
        {
          VGRichText modifiedText = dlg.NewRichText;
          ((VGRichText)this.designPicture.SelectedElement).RtfToDraw = modifiedText.RtfToDraw;
          this.UpdateSelectedElementAndPropertyControl(modifiedText);
        }
      }
      else if (e.Shape is VGImage)
      {
        var image = (VGImage)e.Shape;
        var dlg = new ImageDialog();
        dlg.NewImage = image;
        if (dlg.ShowDialog() == DialogResult.OK)
        {
          VGImage modifiedImage = dlg.NewImage;
          ((VGImage)this.designPicture.SelectedElement).Filename = modifiedImage.Filename;
          ((VGImage)this.designPicture.SelectedElement).Filepath = modifiedImage.Filepath;
          ((VGImage)this.designPicture.SelectedElement).Layout = modifiedImage.Layout;
          ((VGImage)this.designPicture.SelectedElement).CreateInternalImage();
          this.UpdateSelectedElementAndPropertyControl(modifiedImage);
        }
      }
      else if (e.Shape.StyleGroup != VGStyleGroup.AOI_TARGET)
      {
        var dlg = new ShapeDialog();
        dlg.NewShape = e.Shape;
        if (dlg.ShowDialog() == DialogResult.OK)
        {
          this.UpdateSelectedElementAndPropertyControl(dlg.NewShape);
        }
      }
      else if (e.Shape.StyleGroup == VGStyleGroup.AOI_TARGET)
      {
        this.tctStandards.SelectedTab = this.tbpTargets;
      }

      this.designPicture.Invalidate();
    }
예제 #2
0
 /// <summary>
 ///   This method opens a <see cref="RichTextDialog" /> to create a new
 ///   <see cref="VGRichText" /> item on the slide.
 /// </summary>
 private void OpenNewRtfInstructionDialog()
 {
   var dlg = new RichTextDialog();
   dlg.RichTextBackgroundColor = this.btnBackgroundColor.CurrentColor;
   if (dlg.ShowDialog() == DialogResult.OK)
   {
     this.designPicture.NewRtfTextStart(dlg.NewRichText);
   }
 }