Exemple #1
0
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////
    #region CUSTOMEVENTHANDLER

    /// <summary>
    /// The <see cref="OgamaControls.PenAndBrushControl.ShapePropertiesChanged"/> event handler.
    /// Updates the preview with the new edge and fill styles.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">A <see cref="ShapePropertiesChangedEventArgs"/> with the event data.</param>
    private void pbcImageBorder_ShapePropertiesChanged(object sender, ShapePropertiesChangedEventArgs e)
    {
      this.panelPreview.Refresh();
    }
Exemple #2
0
    /// <summary>
    /// This method updates the style of the elements from the given <see cref="VGStyleGroup"/>
    ///   with the new value and updates the pictures styles.
    /// </summary>
    /// <param name="vGStyleGroup">
    /// The <see cref="VGStyleGroup"/> whichs style should
    ///   be changed
    /// </param>
    /// <param name="e">
    /// The <see cref="ShapePropertiesChangedEventArgs"/> with the new style.
    /// </param>
    public void ShapePropertiesChanged(VGStyleGroup vGStyleGroup, ShapePropertiesChangedEventArgs e)
    {
      var sublist = this.Elements.FindAllGroupMembers(vGStyleGroup);

      var showNumbers = false;
      var drawAction = e.ShapeDrawAction;

      if (vGStyleGroup == VGStyleGroup.AOI_STATISTICS_ARROW)
      {
        if ((e.ShapeDrawAction & ShapeDrawAction.Name) == ShapeDrawAction.Name)
        {
          drawAction &= ~ShapeDrawAction.Name;
          showNumbers = true;
        }
      }

      foreach (VGElement element in sublist)
      {
        element.Pen = e.Pen;
        element.Brush = e.Brush;
        element.TextAlignment = e.TextAlignment;
        element.ShapeDrawAction = drawAction;
        if (element is VGArrow)
        {
          ((VGArrow)element).WeightFont = e.NewFont;
          ((VGArrow)element).WeightFontColor = e.NewFontColor;
          if (showNumbers)
          {
            ((VGArrow)element).HideWeights = false;
          }
          else
          {
            ((VGArrow)element).HideWeights = true;
          }
        }
        else
        {
          element.Font = e.NewFont;
          element.FontColor = e.NewFontColor;
        }
      }

      this.DrawForeground(true);

      switch (vGStyleGroup)
      {
        case VGStyleGroup.AOI_STATISTICS_ARROW:
          this.ArrowPen = e.Pen;
          this.ArrowBrush = e.Brush;
          this.ArrowFont = e.NewFont;
          this.ArrowFontColor = e.NewFontColor;
          this.ArrowTextAlignment = e.TextAlignment;
          this.ArrowDrawAction = e.ShapeDrawAction;
          break;
        case VGStyleGroup.AOI_STATISTICS_BUBBLE:
          this.BubblePen = e.Pen;
          this.BubbleBrush = e.Brush;
          this.BubbleFont = e.NewFont;
          this.BubbleFontColor = e.NewFontColor;
          this.BubbleTextAlignment = e.TextAlignment;
          this.BubbleDrawAction = e.ShapeDrawAction;
          break;
      }
    }
Exemple #3
0
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////
    #region CUSTOMEVENTHANDLER

    /// <summary>
    /// The protected OnShapePropertiesChanged method raises the event by invoking 
    /// the delegates
    /// </summary>
    /// <param name="e">A <see cref="ShapePropertiesChangedEventArgs"/> with the event arguments</param>
    protected virtual void OnShapePropertiesChanged(ShapePropertiesChangedEventArgs e)
    {
      if (ShapePropertiesChanged != null)
      {
        // Invokes the delegates. 
        ShapePropertiesChanged(this, e);
      }
    }
Exemple #4
0
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////
    #region CUSTOMEVENTHANDLER

    /// <summary>
    /// <see cref="OgamaControls.PenAndBrushControl.ShapePropertiesChanged"/> event handler 
    /// for the <see cref="OgamaControls.PenAndBrushControl"/> <see cref="pbcBorder"/>
    /// Sets the <see cref="Control.BackgroundImage"/> property to 
    /// the newly created brush fill.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">A <see cref="ShapePropertiesChangedEventArgs"/> with the event data.</param>
    private void pbcBorder_ShapePropertiesChanged(object sender, ShapePropertiesChangedEventArgs e)
    {
      this.UpdateShapeProperties(e.ShapeDrawAction, e.Brush);
    }
Exemple #5
0
 /// <summary>
 /// <see cref="OgamaControls.PenAndBrushControl.ShapePropertiesChanged"/> event handler 
 /// for the <see cref="OgamaControls.PenAndBrushControl"/> <see cref="pbcStyle"/>
 /// Update <see cref="ShapeDrawAction"/> if designed element is a <see cref="VGLine"/>
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">A <see cref="ShapePropertiesChangedEventArgs"/> with the event data.</param>
 private void pbcStyle_ShapePropertiesChanged(object sender, ShapePropertiesChangedEventArgs e)
 {
   if (this.rdbLine.Checked && (e.ShapeDrawAction == (e.ShapeDrawAction | ShapeDrawAction.Fill)))
   {
     this.pbcStyle.DrawAction = ShapeDrawAction.Edge;
   }
 }
Exemple #6
0
 /// <summary>
 /// <see cref="PenAndBrushControl.ShapePropertiesChanged"/> event handler
 ///   for the <see cref="PenAndBrushControl"/> <see cref="pbcElements"/>
 ///   Changes the properties of the selected element if there is any,
 ///   to the new values.
 /// </summary>
 /// <param name="sender">
 /// Source of the event.
 /// </param>
 /// <param name="e">
 /// A <see cref="ShapePropertiesChangedEventArgs"/> with
 ///   the new shape properties.
 /// </param>
 private void pbcElements_ShapePropertiesChanged(object sender, ShapePropertiesChangedEventArgs e)
 {
   if (this.designPicture.SelectedElement != null && !this.isInitializingSelectedShape)
   {
     this.designPicture.SelectedElement.Pen = e.Pen;
     this.designPicture.SelectedElement.Brush = e.Brush;
     this.designPicture.SelectedElement.ShapeDrawAction = e.ShapeDrawAction;
     this.designPicture.SelectedElement.Font = e.NewFont;
     this.designPicture.SelectedElement.FontColor = e.NewFontColor;
     this.designPicture.SelectedElement.Name = e.NewName;
     //this.designPicture.RedrawAll();
     this.designPicture.Invalidate();
   }
 }
Exemple #7
0
    /// <summary>
    /// This method parses the statistic style settings
    ///   submits them to the picture to call the statistical
    ///   drawing function
    /// </summary>
    /// <param name="newPen">
    /// The <see cref="Pen"/> to use for the edge.
    /// </param>
    /// <param name="newBrush">
    /// The <see cref="Brush"/> to use for the fill.
    /// </param>
    /// <param name="newFont">
    /// The <see cref="Font"/> to use.
    /// </param>
    /// <param name="newFontColor">
    /// The <see cref="Color"/> to use for the font.
    /// </param>
    /// <param name="newTextAlignment">
    /// The <see cref="VGAlignment"/> to use.
    /// </param>
    /// <param name="styleGroup">
    /// The <see cref="VGStyleGroup"/> this style should belong to.
    /// </param>
    private void UpdateStatisticProperties(
      Pen newPen, 
      Brush newBrush, 
      Font newFont, 
      Color newFontColor, 
      VGAlignment newTextAlignment, 
      VGStyleGroup styleGroup)
    {
      var drawAction = ShapeDrawAction.None;

      switch (styleGroup)
      {
        case VGStyleGroup.AOI_STATISTICS_BUBBLE:
          if (this.chbBubblePen.Checked)
          {
            drawAction |= ShapeDrawAction.Edge;
          }

          if (this.chbBubbleFont.Checked)
          {
            drawAction |= ShapeDrawAction.Name;
          }

          if (this.chbBubbleBrush.Checked)
          {
            drawAction |= ShapeDrawAction.Fill;
          }

          break;
        case VGStyleGroup.AOI_STATISTICS_ARROW:
          if (this.chbArrowPen.Checked)
          {
            drawAction |= ShapeDrawAction.Edge;
          }

          if (this.chbArrowFont.Checked)
          {
            drawAction |= ShapeDrawAction.Name;
          }

          if (this.chbArrowBrush.Checked)
          {
            drawAction |= ShapeDrawAction.Fill;
          }

          break;
      }

      var ea = new ShapePropertiesChangedEventArgs(
        drawAction, 
        newPen, 
        newBrush, 
        newFont, 
        newFontColor, 
        string.Empty, 
        newTextAlignment);

      this.aoiPicture.ShapePropertiesChanged(styleGroup, ea);
    }