internal bool IsSharedCellSelected(DataGridViewCell dataGridViewCell, int rowIndex)
 {
     Debug.Assert(dataGridViewCell != null);
     Debug.Assert(rowIndex >= 0);
     DataGridViewElementStates rowState = this.Rows.GetRowState(rowIndex);
     return (rowState & DataGridViewElementStates.Selected) != 0 ||
            (dataGridViewCell.OwningColumn != null && dataGridViewCell.OwningColumn.Selected) ||
            dataGridViewCell.StateIncludes(DataGridViewElementStates.Selected);
 }
 private bool IsSharedCellReadOnly(DataGridViewCell dataGridViewCell, int rowIndex)
 {
     Debug.Assert(dataGridViewCell != null);
     Debug.Assert(rowIndex >= 0);
     DataGridViewElementStates rowState = this.Rows.GetRowState(rowIndex); 
     return this.ReadOnly ||
            (rowState & DataGridViewElementStates.ReadOnly) != 0 ||
            (dataGridViewCell.OwningColumn != null && dataGridViewCell.OwningColumn.ReadOnly) ||
            dataGridViewCell.StateIncludes(DataGridViewElementStates.ReadOnly);
 }
 private bool GetCellCount_CellIncluded(DataGridViewCell dataGridViewCell, 
                                        int rowIndex,
                                        bool displayedRequired,
                                        bool frozenRequired, 
                                        bool resizableRequired, 
                                        bool readOnlyRequired, 
                                        bool visibleRequired)
 {
     Debug.Assert(dataGridViewCell != null);
     Debug.Assert(rowIndex >= 0);
     DataGridViewElementStates rowState = this.Rows.GetRowState(rowIndex);
     if (displayedRequired)
     {
         bool cellDisplayed = (rowState & DataGridViewElementStates.Displayed) != 0 &&
                              dataGridViewCell.OwningColumn.Displayed;
         if (!cellDisplayed)
         {
             return false;
         }
     }
     if (frozenRequired)
     {
         bool cellFrozen = (rowState & DataGridViewElementStates.Frozen) != 0 ||
                           dataGridViewCell.OwningColumn.Frozen ||
                           dataGridViewCell.StateIncludes(DataGridViewElementStates.Frozen);
         if (!cellFrozen)
         {
             return false;
         }
     }
     if (resizableRequired)
     {
         if (!RowIsResizable(rowIndex) && dataGridViewCell.OwningColumn.Resizable != DataGridViewTriState.True)
         {
             return false;
         }
     }
     if (readOnlyRequired)
     {
         bool cellReadOnly = this.ReadOnly ||
                             (rowState & DataGridViewElementStates.ReadOnly) != 0 ||
                             dataGridViewCell.OwningColumn.ReadOnly ||
                             dataGridViewCell.StateIncludes(DataGridViewElementStates.ReadOnly);
         if (!cellReadOnly)
         {
             return false;
         }
     }
     if (visibleRequired)
     {
         bool cellVisible = (rowState & DataGridViewElementStates.Visible) != 0 &&
                            dataGridViewCell.OwningColumn.Visible;
         if (!cellVisible)
         {
             return false;
         }
     }
     return true;
 }
 internal bool IsSharedCellSelected(DataGridViewCell dataGridViewCell, int rowIndex)
 {
     return ((((this.Rows.GetRowState(rowIndex) & DataGridViewElementStates.Selected) != DataGridViewElementStates.None) || ((dataGridViewCell.OwningColumn != null) && dataGridViewCell.OwningColumn.Selected)) || dataGridViewCell.StateIncludes(DataGridViewElementStates.Selected));
 }
 private bool IsSharedCellReadOnly(DataGridViewCell dataGridViewCell, int rowIndex)
 {
     DataGridViewElementStates rowState = this.Rows.GetRowState(rowIndex);
     return (((this.ReadOnly || ((rowState & DataGridViewElementStates.ReadOnly) != DataGridViewElementStates.None)) || ((dataGridViewCell.OwningColumn != null) && dataGridViewCell.OwningColumn.ReadOnly)) || dataGridViewCell.StateIncludes(DataGridViewElementStates.ReadOnly));
 }
 private bool GetCellCount_CellIncluded(DataGridViewCell dataGridViewCell, int rowIndex, bool displayedRequired, bool frozenRequired, bool resizableRequired, bool readOnlyRequired, bool visibleRequired)
 {
     DataGridViewElementStates rowState = this.Rows.GetRowState(rowIndex);
     if (displayedRequired && !(((rowState & DataGridViewElementStates.Displayed) != DataGridViewElementStates.None) && dataGridViewCell.OwningColumn.Displayed))
     {
         return false;
     }
     if (frozenRequired && !((((rowState & DataGridViewElementStates.Frozen) != DataGridViewElementStates.None) || dataGridViewCell.OwningColumn.Frozen) || dataGridViewCell.StateIncludes(DataGridViewElementStates.Frozen)))
     {
         return false;
     }
     if ((resizableRequired && !this.RowIsResizable(rowIndex)) && (dataGridViewCell.OwningColumn.Resizable != DataGridViewTriState.True))
     {
         return false;
     }
     if (readOnlyRequired && !(((this.ReadOnly || ((rowState & DataGridViewElementStates.ReadOnly) != DataGridViewElementStates.None)) || dataGridViewCell.OwningColumn.ReadOnly) || dataGridViewCell.StateIncludes(DataGridViewElementStates.ReadOnly)))
     {
         return false;
     }
     if (visibleRequired && !(((rowState & DataGridViewElementStates.Visible) != DataGridViewElementStates.None) && dataGridViewCell.OwningColumn.Visible))
     {
         return false;
     }
     return true;
 }