Esempio n. 1
0
 public void SetFilterBehavior(ADGVColumnHeaderCellBehavior behavior, DataGridViewColumn column = null)
 {
     if (column == null)
     {
         foreach (DataGridViewColumn c in this.Columns)
         {
             ADGVColumnHeaderCell cell = c.HeaderCell as ADGVColumnHeaderCell;
             if (cell != null)
             {
                 cell.CellBehavior = behavior;
             }
         }
     }
     else if (this.Columns.Contains(column))
     {
         ADGVColumnHeaderCell cell = column.HeaderCell as ADGVColumnHeaderCell;
         if (cell != null)
         {
             cell.CellBehavior = behavior;
         }
     }
 }
Esempio n. 2
0
        public ADGVColumnHeaderCell(DataGridViewColumnHeaderCell oldCell, ADGVColumnHeaderCellBehavior cellBehavior)
        {
            this.Tag              = oldCell.Tag;
            this.ErrorText        = oldCell.ErrorText;
            this.ToolTipText      = oldCell.ToolTipText;
            this.Value            = oldCell.Value;
            this.ValueType        = oldCell.ValueType;
            this.ContextMenuStrip = oldCell.ContextMenuStrip;
            this.Style            = oldCell.Style;
            this.cellBehavior     = cellBehavior;

            ADGVColumnHeaderCell oldADGVCell = oldCell as ADGVColumnHeaderCell;

            if (oldADGVCell != null)
            {
                if (oldADGVCell.FilterMenu != null)
                {
                    this.FilterMenu = oldADGVCell.FilterMenu.Clone() as ADGVFilterMenu;
                }
                else
                {
                    this.FilterMenu = new ADGVFilterMenu(oldCell.OwningColumn.ValueType);
                }

                this.filterButtonPressed      = oldADGVCell.filterButtonPressed;
                this.filterButtonOver         = oldADGVCell.filterButtonOver;
                this.filterButtonOffsetBounds = oldADGVCell.filterButtonOffsetBounds;
                this.filterButtonImageBounds  = oldADGVCell.filterButtonImageBounds;
            }
            else
            {
                this.FilterMenu = new ADGVFilterMenu(oldCell.OwningColumn.ValueType);
            }

            this.FilterMenu.FilterChanged           += FilterMenu_FilterChanged;
            this.FilterMenu.SortChanged             += FilterMenu_SortChanged;
            this.FilterMenu.DateTimeGroupingChanged += FilterMenu_DateTimeGroupingChanged;
        }