/// <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; } }
/////////////////////////////////////////////////////////////////////////////// // 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); } }
/// <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; } }
/////////////////////////////////////////////////////////////////////////////// // 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(); }
/////////////////////////////////////////////////////////////////////////////// // 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); }