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