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

        #endregion //EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Methods and Eventhandling for Background tasks                            //
        ///////////////////////////////////////////////////////////////////////////////
        #region BACKGROUNDWORKER
        #endregion //BACKGROUNDWORKER

        ///////////////////////////////////////////////////////////////////////////////
        // Inherited methods                                                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region OVERRIDES
        #endregion //OVERRIDES

        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// Opens <see cref="PenStyleDlg"/> and updates application settings and
        /// given pen style area when new pen style is choosen.
        /// </summary>
        /// <param name="psa">A <see cref="PenStyleArea"/> that visualizes the changed pen.</param>
        /// <param name="colorToSet">Out. An Application Setting Pen <see cref="Color"/>.</param>
        /// <param name="styleToSet">Out. An Application Setting Pen <see cref="DashStyle"/>.</param>
        /// <param name="widthToSet">Out. An <see cref="Single"/> with the Application Setting Pen Width</param>
        /// <returns><strong>True</strong>, if style should be applied to settings,
        /// otherwise <strong>false</strong> (User cancelled dialog)</returns>
        private bool btnPenStyleClicked(
            PenStyleArea psa,
            out Color colorToSet,
            out DashStyle styleToSet,
            out float widthToSet)
        {
            PenStyleDlg dlgStyle = new PenStyleDlg();

            dlgStyle.Text = "Set pen style...";
            dlgStyle.Pen  = psa.Pen;
            dlgStyle.Icon = Properties.Resources.RPLCursorPenIcon;
            if (dlgStyle.ShowDialog() == DialogResult.OK)
            {
                psa.Pen = dlgStyle.Pen;
                psa.Refresh();
                colorToSet = dlgStyle.Pen.Color;
                styleToSet = dlgStyle.Pen.DashStyle;
                widthToSet = dlgStyle.Pen.Width;
                return(true);
            }
            else
            {
                colorToSet = Color.Empty;
                styleToSet = DashStyle.Custom;
                widthToSet = 0;
                return(false);
            }
        }
 /// <summary>
 /// The <see cref="Control.Click"/> event handler for
 /// the <see cref="Button"/> <see cref="btnConnectionsStyle"/>.
 /// Updates the colorization property of the selected subject or group
 /// with the changes made in the <see cref="PenStyleDlg"/> for
 /// the fixation connection pen.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">An empty <see cref="EventArgs"/></param>
 private void btnConnectionsStyle_Click(object sender, EventArgs e)
 {
     if (this.trvSubjects.SelectedNode != null)
     {
         PenStyleDlg dlg = new PenStyleDlg();
         dlg.Pen = this.selectedConnectionsPen;
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             this.selectedConnectionsPen = dlg.Pen;
             this.SubmitStyleToSubjectOrCategory();
         }
     }
 }
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region WINDOWSEVENTHANDLER
        /// <summary>
        /// <see cref="Control.Click"/> event handler
        /// for the <see cref="Button"/> <see cref="btnPenStyle"/>
        /// Raises a <see cref="PenStyleDlg"/>.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">A empty <see cref="EventArgs"/></param>
        private void btnPenStyle_Click(object sender, EventArgs e)
        {
            PenStyleDlg dlgStyle = new PenStyleDlg();

            dlgStyle.Text = "Set pen style ...";
            dlgStyle.Pen  = psaLinestyle.Pen;
            if (dlgStyle.ShowDialog() == DialogResult.OK)
            {
                psaLinestyle.Pen = dlgStyle.Pen;
                OnShapePropertiesChanged(new ShapePropertiesChangedEventArgs(GetDrawAction(),
                                                                             this.NewPen, this.NewBrush, this.NewFont, this.NewFontColor, this.NewName, this.textAlignment));
            }
        }