예제 #1
0
        protected override void OnMouseDoubleClick(DataGridViewCellMouseEventArgs e)
        {
            //  if (this.OwningRow.Index < 0) return;

            ICalculableRow Icalc = GetICalculable(e.RowIndex);

            if (Icalc != null)
            {
                Icalc.ToDo = !Icalc.ToDo;
            }

            base.DataGridView.NotifyCurrentCellDirty(true);
            base.DataGridView.ClearSelection();
            base.OnMouseDoubleClick(e);
        }
예제 #2
0
        /// <summary>
        /// Gets the ICalculableRow Interface to the Row that this DGV cell is binded to
        /// </summary>
        /// <returns></returns>
        public ICalculableRow GetICalculable(int rowIndex)
        {
            ICalculableRow Icalc = null;

            if (rowIndex <= -1)
            {
                return(Icalc);
            }
            DataGridViewRow r = this.DataGridView.Rows[rowIndex];
            DataRowView     v = r?.DataBoundItem as DataRowView;
            DataRow         u = (v?.Row) as DataRow;

            if (!EC.IsNuDelDetch(u))
            {
                Icalc = u as ICalculableRow;
            }
            return(Icalc);
        }
예제 #3
0
        /// <summary>
        /// Paints red, green and orange based on the ToDo and IsBusy conditionals
        /// </summary>
        /// <param name="graphics">           </param>
        /// <param name="clipBounds">         </param>
        /// <param name="cellBounds">         </param>
        /// <param name="rowIndex">           </param>
        /// <param name="cellState">          </param>
        /// <param name="value">              </param>
        /// <param name="formattedValue">     </param>
        /// <param name="errorText">          </param>
        /// <param name="cellStyle">          </param>
        /// <param name="advancedBorderStyle"></param>
        /// <param name="paintParts">         </param>
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            setDefaultCellStyle();

            //if (this.OwningRow.Index < 0) return;

            //changed is not used
            //but could be used
            ICalculableRow Icalc = GetICalculable(rowIndex);

            bool? todo    = Icalc?.ToDo;
            bool? isBusy  = Icalc?.IsBusy;
            Color colr    = getColor(todo, isBusy);
            bool  changed = hasChanged(ref cellStyle, ref colr);



            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            //    base.DataGridView.NotifyCurrentCellDirty(true);
            //  base.DataGridView.ClearSelection();
        }