/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the FontChangedEventArgs class. /// </summary> /// <param name="newFont">The newly created <see cref="Font"/></param> /// <param name="newColor">The <see cref="Color"/> for the newly created font.</param> /// <param name="newAlignment">The <see cref="VGAlignment"/> for the newly created font.</param> /// <param name="newGroup">vector graphics /// group to which the new font should be applied.</param> public FontChangedEventArgs(Font newFont, Color newColor, VGAlignment newAlignment, VGStyleGroup newGroup) { this.font = newFont; this.fontColor = newColor; this.fontAlignment = newAlignment; this.elementGroup = newGroup; }
/// <summary> /// Overridden. Initializes the drawing elements of this <see cref="SlidePicture"/> /// by calling the <c>Properties.Settings.Default</c> values with /// <see cref="PictureModifiable.InitializeElements(Pen,Pen,Pen,Pen,Font,Color,Font,Color,Font,Color, VGAlignment, VGAlignment, VGAlignment)"/>. /// </summary> protected override void InitializePictureDefaultElements() { // AppSettings are always set except when in design mode if (Properties.Settings.Default != null) { Pen targetPen = new Pen(Properties.Settings.Default.AOITargetColor, Properties.Settings.Default.AOITargetWidth); targetPen.DashStyle = Properties.Settings.Default.AOITargetStyle; targetPen.LineJoin = LineJoin.Miter; Pen dottedPen = new Pen(Properties.Settings.Default.AOIStandardColor, Properties.Settings.Default.AOIStandardWidth); dottedPen.DashStyle = DashStyle.Dash; dottedPen.LineJoin = LineJoin.Miter; Pen defaultPen = new Pen(Properties.Settings.Default.AOIStandardColor, Properties.Settings.Default.AOIStandardWidth); defaultPen.DashStyle = Properties.Settings.Default.AOIStandardStyle; defaultPen.LineJoin = LineJoin.Miter; Pen searchRectPen = new Pen(Properties.Settings.Default.AOISearchRectColor, Properties.Settings.Default.AOISearchRectWidth); searchRectPen.DashStyle = Properties.Settings.Default.AOISearchRectStyle; searchRectPen.LineJoin = LineJoin.Miter; Font targetFont = (Font)Properties.Settings.Default.AOITargetFont.Clone(); Color targetFontColor = Properties.Settings.Default.AOITargetFontColor; Font defaultFont = (Font)Properties.Settings.Default.AOIStandardFont.Clone(); Color defaultFontColor = Properties.Settings.Default.AOIStandardFontColor; Font searchRectFont = (Font)Properties.Settings.Default.AOISearchRectFont.Clone(); Color searchRectFontColor = Properties.Settings.Default.AOISearchRectFontColor; VGAlignment defaultTextAlignment = (VGAlignment)Enum.Parse(typeof(VGAlignment), Properties.Settings.Default.AOIDefaultTextAlignment); VGAlignment targetTextAlignment = (VGAlignment)Enum.Parse(typeof(VGAlignment), Properties.Settings.Default.AOITargetTextAlignment); VGAlignment searchRectTextAlignment = (VGAlignment)Enum.Parse(typeof(VGAlignment), Properties.Settings.Default.AOISearchRectTextAlignment); this.InitializeElements( targetPen, dottedPen, defaultPen, searchRectPen, targetFont, targetFontColor, defaultFont, defaultFontColor, searchRectFont, searchRectFontColor, targetTextAlignment, defaultTextAlignment, searchRectTextAlignment); } }
/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the ShapePropertiesChangedEventArgs class. /// </summary> /// <param name="newDrawAction">New <see cref="ShapeDrawAction"/> that should be used.</param> /// <param name="newPen">new <see cref="Pen"/> for the element.</param> /// <param name="newBrush">new <see cref="Brush"/> for the element.</param> /// <param name="newFont">new <see cref="Font"/> for the element.</param> /// <param name="newFontColor">new font <see cref="Color"/> for the element.</param> /// <param name="newName">new elements name.</param> /// <param name="newAlignment">new elements <see cref="VGAlignment"/>.</param> public ShapePropertiesChangedEventArgs( ShapeDrawAction newDrawAction, Pen newPen, Brush newBrush, Font newFont, Color newFontColor, string newName, VGAlignment newAlignment) { this.drawAction = newDrawAction; this.pen = newPen; this.brush = newBrush; this.font = newFont; this.fontColor = newFontColor; this.name = newName; this.newFontAlignment = newAlignment; }
/// <summary> /// <see cref="Control.Click"/> event handler /// for the <see cref="Button"/> <see cref="btnFont"/> /// Raises a <see cref="BrushStyleDlg"/>. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">A empty <see cref="EventArgs"/></param> private void btnFont_Click(object sender, EventArgs e) { FontStyleDlg dlgStyle = new FontStyleDlg(); dlgStyle.Text = "Set font style for the elements name ..."; dlgStyle.CurrentFont = btnFont.Font; dlgStyle.CurrentFontColor = txbName.ForeColor; dlgStyle.CurrentFontAlignment = this.textAlignment; if (dlgStyle.ShowDialog() == DialogResult.OK) { btnFont.Font = dlgStyle.CurrentFont; txbName.ForeColor = dlgStyle.CurrentFontColor; this.textAlignment = dlgStyle.CurrentFontAlignment; OnShapePropertiesChanged(new ShapePropertiesChangedEventArgs(GetDrawAction(), this.NewPen, this.NewBrush, this.NewFont, this.NewFontColor, this.NewName, this.textAlignment)); } }
/////////////////////////////////////////////////////////////////////////////// // Methods and Eventhandling for Background tasks // /////////////////////////////////////////////////////////////////////////////// #region BACKGROUNDWORKER #endregion //BACKGROUNDWORKER /////////////////////////////////////////////////////////////////////////////// // Inherited methods // /////////////////////////////////////////////////////////////////////////////// #region OVERRIDES #endregion //OVERRIDES /////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region METHODS private void RecreateFont() { if (cbbFontStyle.SelectedItem != null) { Single fontSize = (float)nudFontSize.Value; FontStyle style = (FontStyle)this.cbbFontStyle.SelectedItem; this.alignment = (VGAlignment)this.cbbAlignment.SelectedItem; font = new Font(cbbFontFace.Text, fontSize, style); fontColor = fontColorSelectControl.SelectedColor; fontStyleArea.FontColor = fontColor; fontStyleArea.Font = font; fontStyleArea.FontAlignment = this.alignment; OnFontStyleChanged(new FontChangedEventArgs( this.font, this.fontColor, this.alignment, VGStyleGroup.None)); } }
/// <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); }
/// <summary> /// Initializes standard values of drawing elements /// </summary> /// <param name="targetPen">A <see cref="Pen"/> for "target" elements</param> /// <param name="dottedPen">A <see cref="Pen"/> for dotted elements</param> /// <param name="defaultPen">A <see cref="Pen"/> for default elements</param> /// <param name="searchRectPen">A <see cref="Pen"/> for "searchRect" elements</param> /// <param name="targetFont">A <see cref="Font"/> for "target" elements</param> /// <param name="targetFontColor">A <see cref="Color"/> for "target" elements</param> /// <param name="defaultFont">A <see cref="Font"/> for default elements</param> /// <param name="defaultFontColor">A <see cref="Color"/> for default elements</param> /// <param name="searchRectFont">A <see cref="Font"/> for "searchRect" elements</param> /// <param name="searchRectFontColor">A <see cref="Color"/> for "searchRect" elements</param> /// <param name="targetTextAlignment">A <see cref="VGAlignment"/> for default elements</param> /// <param name="defaultTextAlignment">A <see cref="VGAlignment"/> for "target" elements</param> /// <param name="searchRectTextAlignment">A <see cref="VGAlignment"/> for "searchRect" elements</param> protected void InitializeElements( Pen targetPen, Pen dottedPen, Pen defaultPen, Pen searchRectPen, Font targetFont, Color targetFontColor, Font defaultFont, Color defaultFontColor, Font searchRectFont, Color searchRectFontColor, VGAlignment targetTextAlignment, VGAlignment defaultTextAlignment, VGAlignment searchRectTextAlignment) { this.targetPen = targetPen; this.targetFont = targetFont; this.targetFontColor = targetFontColor; this.defaultPen = defaultPen; this.defaultFont = defaultFont; this.defaultFontColor = defaultFontColor; this.searchRectPen = searchRectPen; this.searchRectFont = searchRectFont; this.searchRectFontColor = searchRectFontColor; this.dottedPen = dottedPen; this.targetTextAlignment = targetTextAlignment; this.defaultTextAlignment = defaultTextAlignment; this.searchRectTextAlignment = searchRectTextAlignment; }