/// <summary>
        /// This raises the <see cref="IndicatorClicked"/> event
        /// </summary>
        /// <param name="e">The event arguments</param>
        protected internal virtual void OnIndicatorClicked(IndicatorClickEventArgs e)
        {
            var handler = IndicatorClicked;

            if (handler != null)
            {
                // Reset the cursor.  If the user goes to another form, the cursor doesn't get reset after
                // returning to the one containing the grid view.
                if (base.DataGridView.Cursor != originalCursor)
                {
                    base.DataGridView.Cursor = originalCursor;
                }

                handler(this, e);
            }
        }
Exemple #2
0
        /// <summary>
        /// This is overridden to raise the <see cref="IndicatorColumn.IndicatorClicked"/> event when an image
        /// is clicked.  The event is not raised if <see cref="IsClickable"/> is set to false.
        /// </summary>
        /// <param name="e">The event arguments</param>
        protected override void OnContentClick(DataGridViewCellEventArgs e)
        {
            IndicatorColumn owner = base.OwningColumn as IndicatorColumn;

            if (this.IsClickable && base.DataGridView != null && owner != null && this.MouseImageIndex != -1 &&
                this.MouseImageIndex < owner.ImageList.Images.Count)
            {
                IndicatorClickEventArgs clickArgs = new IndicatorClickEventArgs(e.ColumnIndex, e.RowIndex,
                                                                                this.MouseImageIndex, base.NewValue);

                owner.OnIndicatorClicked(clickArgs);

                if (!base.ReadOnly && ((clickArgs.Value == null && base.NewValue != null) ||
                                       (clickArgs.Value != null && !clickArgs.Value.Equals(base.NewValue))))
                {
                    base.NewValue = clickArgs.Value;
                    base.DataGridView.NotifyCurrentCellDirty(true);
                    base.DataGridView.InvalidateCell(this);
                }
            }
        }
        /// <summary>
        /// This raises the <see cref="IndicatorClicked"/> event
        /// </summary>
        /// <param name="e">The event arguments</param>
        protected internal virtual void OnIndicatorClicked(IndicatorClickEventArgs e)
        {
            var handler = IndicatorClicked;

            if(handler != null)
            {
                // Reset the cursor.  If the user goes to another form, the cursor doesn't get reset after
                // returning to the one containing the grid view.
                if(base.DataGridView.Cursor != originalCursor)
                    base.DataGridView.Cursor = originalCursor;

                handler(this, e);
            }
        }
        /// <summary>
        /// This is overridden to raise the <see cref="IndicatorColumn.IndicatorClicked"/> event when an image
        /// is clicked.  The event is not raised if <see cref="IsClickable"/> is set to false.
        /// </summary>
        /// <param name="e">The event arguments</param>
        protected override void OnContentClick(DataGridViewCellEventArgs e)
        {
            IndicatorColumn owner = base.OwningColumn as IndicatorColumn;

            if(this.IsClickable && base.DataGridView != null && owner != null && this.MouseImageIndex != -1 &&
              this.MouseImageIndex < owner.ImageList.Images.Count)
            {
                IndicatorClickEventArgs clickArgs = new IndicatorClickEventArgs(e.ColumnIndex, e.RowIndex,
                    this.MouseImageIndex, base.NewValue);

                owner.OnIndicatorClicked(clickArgs);

                if(!base.ReadOnly && ((clickArgs.Value == null && base.NewValue != null) ||
                  (clickArgs.Value != null && !clickArgs.Value.Equals(base.NewValue))))
                {
                    base.NewValue = clickArgs.Value;
                    base.DataGridView.NotifyCurrentCellDirty(true);
                    base.DataGridView.InvalidateCell(this);
                }
            }
        }