//===================================================================== /// <summary> /// This is used to notify the data grid view of a change that may require it to resize the column and /// possibly the row. /// </summary> protected void OnCommonChange() { if (base.DataGridView != null && !base.DataGridView.IsDisposed && !base.DataGridView.Disposing) { if (base.RowIndex == -1) { DataGridViewHelper.OnColumnCommonChange(base.DataGridView, base.ColumnIndex); } else { DataGridViewHelper.OnCellCommonChange(base.DataGridView, base.ColumnIndex, base.RowIndex); } } }
/// <summary> /// Gets the image to display in the cell /// </summary> /// <param name="value">The value to be use in determining the image</param> /// <param name="rowIndex">The index of the cell's parent row</param> /// <returns>The image that should be displayed in the cell</returns> protected override object GetCellImage(object value, int rowIndex) { RatingColumn owner = base.OwningColumn as RatingColumn; // If this is a shared cell, we don't want to draw hot images as they may end up in several places. // As such, only draw them if the mouse is in the cell being drawn. Point mouseCell = DataGridViewHelper.MouseEnteredCellAddress(base.DataGridView); if (owner != null) { return(owner.DrawImage(value, rowIndex, (mouseCell.X == owner.Index && mouseCell.Y == rowIndex) ? this.MouseRating : -1)); } return(null); }
/// <summary> /// Indicates whether a row will be unshared when the mouse pointer moves over a cell in the row /// </summary> /// <param name="rowIndex">The index of the row containing the cell</param> /// <returns>True if the mouse is in the cell in which the mouse button was pressed, otherwise false</returns> protected override bool MouseEnterUnsharesRow(int rowIndex) { Point cell = DataGridViewHelper.MouseDownCellAddress(base.DataGridView); return(base.ColumnIndex == cell.X && rowIndex == cell.Y); }