Beispiel #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for Custom Defined Events                                    //
        ///////////////////////////////////////////////////////////////////////////////
        #region CUSTOMEVENTHANDLER
        #endregion //CUSTOMEVENTHANDLER

        #endregion //EVENTS

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

        /// <summary>
        /// Initializes standard values of drawing elements
        /// </summary>
        private void InitializeElements()
        {
            try
            {
                this.penGazeCursor           = new Pen(Properties.Settings.Default.GazeCursorColor, Properties.Settings.Default.GazeCursorWidth);
                this.penGazeCursor.DashStyle = Properties.Settings.Default.GazeCursorStyle;

                this.penMouseCursor           = new Pen(Properties.Settings.Default.MouseCursorColor, Properties.Settings.Default.MouseCursorWidth);
                this.penMouseCursor.DashStyle = Properties.Settings.Default.MouseCursorStyle;

                float gazeCursorSize = (float)Properties.Settings.Default.GazeCursorSize;
                VGCursor.DrawingCursors gazeCursorType = (VGCursor.DrawingCursors)Enum.Parse(
                    typeof(VGCursor.DrawingCursors), Properties.Settings.Default.GazeCursorType);
                this.gazeCursor = new VGCursor(this.penGazeCursor, gazeCursorType, gazeCursorSize, VGStyleGroup.RPL_PEN_GAZE_CURSOR);

                float mouseCursorSize = (float)Properties.Settings.Default.MouseCursorSize;
                VGCursor.DrawingCursors mouseCursorType = (VGCursor.DrawingCursors)Enum.Parse(
                    typeof(VGCursor.DrawingCursors), Properties.Settings.Default.MouseCursorType);
                this.mouseCursor = new VGCursor(this.penMouseCursor, mouseCursorType, mouseCursorSize, VGStyleGroup.RPL_PEN_MOUSE_CURSOR);
            }
            catch (Exception ex)
            {
                ExceptionMethods.HandleException(ex);
            }
        }
 /// <summary>
 /// The <see cref="ComboBox.SelectionChangeCommitted"/> event handler for
 /// the <see cref="ComboBox"/> <see cref="cbbCursorType"/>.
 /// Updates <see cref="_cursor"/> properties and raises <see cref="CursorStyleChanged"/> event.
 /// </summary>
 /// <param name="sender">Source of the event</param>
 /// <param name="e">An empty <see cref="EventArgs"/></param>
 private void cbbCursorType_SelectionChangeCommitted(object sender, EventArgs e)
 {
     VGCursor.DrawingCursors cursorType = (VGCursor.DrawingCursors)Enum.Parse(
         typeof(VGCursor.DrawingCursors), cbbCursorType.SelectedItem.ToString());
     _cursor = new VGCursor(_cursor.Pen, cursorType, _cursor.Width, _cursor.StyleGroup);
     CheckForCorrectSize();
     _cursor.Center = new PointF(pnlPreview.Width / 2, pnlPreview.Height / 2);
     pnlPreview.Invalidate();
     OnCursorStyleChanged(new ShapeEventArgs((VGElement)_cursor.Clone()));
 }
 /// <summary>
 /// The controls <see cref="UserControl.Load"/> event handler.
 /// Creates a predefined cursor.
 /// </summary>
 /// <param name="sender">Source of the event</param>
 /// <param name="e">An empty <see cref="EventArgs"/></param>
 private void CursorSelectControl_Load(object sender, EventArgs e)
 {
     if (_cursor == null)
     {
         _cursor = new VGCursor(DEFAULT_CURSOR_PEN,
                                DEFAULT_CURSOR_STYLE, DEFAULT_CURSOR_SIZE, VGStyleGroup.None);
         _cursor.Center = new PointF(pnlPreview.Width / 2, pnlPreview.Height / 2);
     }
     this.cbbCursorType.Items.AddRange(Enum.GetNames(typeof(VGCursor.DrawingCursors)));
     this.cbbCursorType.SelectedItem = _cursor.CursorType;
 }