Exemplo n.º 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();
    }
 /// <summary>
 /// The <see cref="Control.Click"/> event handler for the
 /// <see cref="Button"/> <see cref="btnShapes"/>.
 /// Shows a <see cref="ShapeDialog"/> to define a shape
 /// element that is added to all imported slides.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">An empty <see cref="EventArgs"/></param>
 private void btnShapes_Click(object sender, EventArgs e)
 {
   ShapeDialog dlg = new ShapeDialog();
   if (dlg.ShowDialog() == DialogResult.OK)
   {
     VGElement shape = dlg.NewShape;
     this.cbbDesignedItem.Items.Add(shape);
     this.cbbDesignedItem.SelectedItem = shape;
   }
 }
Exemplo n.º 3
0
 /// <summary>
 ///   This method opens a <see cref="ShapeDialog" /> to create a new
 ///   <see cref="VGElement" /> shape item on the slide.
 /// </summary>
 private void OpenNewShapeDialog()
 {
   var dlg = new ShapeDialog();
   if (dlg.ShowDialog() == DialogResult.OK)
   {
     this.designPicture.NewShapeStart(dlg.NewShape);
   }
 }