Example #1
0
    /// <summary>
    /// The <see cref="Control.Click"/> event handler for the
    /// <see cref="Button"/> <see cref="btnMousePenStyle"/>.
    /// Opens a <see cref="PenAndFontStyleDlg"/> and wires update events to
    /// member methods <see cref="OnPenChanged"/> and <see cref="OnFontStyleChanged"/>
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">An empty <see cref="EventArgs"/></param>
    private void btnMousePenStyle_Click(object sender, EventArgs e)
    {
      Pen backupPen = this.fixationsPicture.MouseFixationsPen;
      Font backupFont = this.fixationsPicture.MouseFixationsFont;
      SolidBrush backupBrush = new SolidBrush(this.fixationsPicture.MouseFixationsFontColor);
      PenAndFontStyleDlg dlgFixationStyle = new PenAndFontStyleDlg();
      dlgFixationStyle.Text = "Set mouse fixations pen and font style...";
      dlgFixationStyle.Pen = this.fixationsPicture.MouseFixationsPen;
      dlgFixationStyle.CustomFont = this.fixationsPicture.MouseFixationsFont;
      dlgFixationStyle.CustomFontBrush = new SolidBrush(this.fixationsPicture.MouseFixationsFontColor);
      dlgFixationStyle.PenChanged += new EventHandler<PenChangedEventArgs>(this.OnPenChanged);
      dlgFixationStyle.FontStyleChanged += new EventHandler<FontChangedEventArgs>(this.OnFontStyleChanged);

      if (dlgFixationStyle.ShowDialog() == DialogResult.Cancel)
      {
        PenChangedEventArgs ea = new PenChangedEventArgs(backupPen, VGStyleGroup.FIX_MOUSE_ELEMENT);
        FontChangedEventArgs eaf = new FontChangedEventArgs(backupFont, backupBrush.Color, VGAlignment.Center, VGStyleGroup.FIX_MOUSE_ELEMENT);
        this.fixationsPicture.PenChanged(this, ea);
        this.fixationsPicture.FontStyleChanged(this, eaf);
      }
    }
Example #2
0
    /// <summary>
    /// The <see cref="Control.Click"/> event handler for the
    ///   <see cref="Button"/> <see cref="btnStyleTarget"/>.
    ///   Shows a <see cref="PenAndFontStyleDlg"/> for the target areas of interest.
    /// </summary>
    /// <param name="sender">
    /// Source of the event.
    /// </param>
    /// <param name="e">
    /// An empty <see cref="EventArgs"/>
    /// </param>
    private void btnStyleTarget_Click(object sender, EventArgs e)
    {
      Pen backupPen = this.aoiPicture.TargetPen;
      Font backupFont = this.aoiPicture.TargetFont;
      var backupBrush = new SolidBrush(this.aoiPicture.TargetFontColor);
      VGAlignment backupAlignment = this.aoiPicture.TargetTextAlignment;

      var dlgTargetStyle = new PenAndFontStyleDlg();
      dlgTargetStyle.Text = "Set target AOI pen and font style...";
      dlgTargetStyle.Pen = this.aoiPicture.TargetPen;
      dlgTargetStyle.CustomFont = this.aoiPicture.TargetFont;
      dlgTargetStyle.CustomFontBrush = new SolidBrush(this.aoiPicture.TargetFontColor);
      dlgTargetStyle.CustomFontTextAlignment = this.aoiPicture.TargetTextAlignment;

      dlgTargetStyle.PenChanged += this.dlgTargetStyle_PenChanged;
      dlgTargetStyle.FontStyleChanged += this.dlgTargetStyle_FontStyleChanged;
      if (dlgTargetStyle.ShowDialog() == DialogResult.Cancel)
      {
        var ea = new PenChangedEventArgs(backupPen, VGStyleGroup.AOI_TARGET);
        var eaf = new FontChangedEventArgs(backupFont, backupBrush.Color, backupAlignment, VGStyleGroup.AOI_TARGET);
        this.aoiPicture.PenChanged(this, ea);
        this.aoiPicture.FontStyleChanged(this, eaf);
      }
    }