Exemplo n.º 1
0
 private void DataGridView_ColumnRemoved(object sender, DataGridViewColumnEventArgs e)
 {
     if (e.Column.HeaderCell is StudyFilterColumnHeaderCell)
     {
         StudyFilterColumnHeaderCell header = (StudyFilterColumnHeaderCell)e.Column.HeaderCell;
         header.DropDownHidden -= HeaderCell_DropDownHidden;
         header.DropDownShown  -= HeaderCell_DropDownShown;
     }
 }
Exemplo n.º 2
0
        public void SetColumnFilteringActive(int columnIndex, bool isActive)
        {
            StudyFilterColumnHeaderCell header = base.DataGridView.Columns[columnIndex].HeaderCell as StudyFilterColumnHeaderCell;

            if (header != null)
            {
                header.Filtered = isActive;
            }
        }
Exemplo n.º 3
0
 private void DataGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e)
 {
     if (!(e.Column.HeaderCell is StudyFilterColumnHeaderCell))
     {
         StudyFilterColumnHeaderCell header = new StudyFilterColumnHeaderCell(e.Column.HeaderCell);
         header.DropDownShown  += HeaderCell_DropDownShown;
         header.DropDownHidden += HeaderCell_DropDownHidden;
         e.Column.SortMode      = DataGridViewColumnSortMode.Programmatic;
         e.Column.HeaderCell    = header;
     }
 }
Exemplo n.º 4
0
 private void ParentForm_Activated(object sender, EventArgs e)
 {
     // if the parent form
     if (!_columnFilterMenuStrip.Visible)
     {
         StudyFilterColumnHeaderCell header = _columnFilterMenuStrip.Tag as StudyFilterColumnHeaderCell;
         if (header != null)
         {
             header.ResetDropDown();
         }
     }
 }
Exemplo n.º 5
0
 private void HeaderCell_DropDownShown(object sender, EventArgs e)
 {
     if (_columnFilterActionModelDelegate != null)
     {
         StudyFilterColumnHeaderCell header = sender as StudyFilterColumnHeaderCell;
         if (header != null)
         {
             Rectangle headerBounds = this.DataGridView.GetCellDisplayRectangle(header.ColumnIndex, -1, false);
             _columnFilterMenuStrip.Tag = header;
             ShowContextMenu(_columnFilterMenuStrip, _columnFilterActionModelDelegate(-1, header.ColumnIndex),
                             base.DataGridView.PointToScreen(new Point(headerBounds.Right, headerBounds.Bottom)),
                             headerBounds.Width, true);
         }
     }
 }
Exemplo n.º 6
0
        private void ColumnFilterMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            switch (e.CloseReason)
            {
            case ToolStripDropDownCloseReason.CloseCalled:
                break;

            case ToolStripDropDownCloseReason.AppClicked:
            case ToolStripDropDownCloseReason.AppFocusChange:
            case ToolStripDropDownCloseReason.Keyboard:
            case ToolStripDropDownCloseReason.ItemClicked:
            default:
                StudyFilterColumnHeaderCell header = _columnFilterMenuStrip.Tag as StudyFilterColumnHeaderCell;
                if (header != null)
                {
                    Platform.Log(LogLevel.Debug, "{0} ColumnFilterMenuStrip_Closing because of {1}", DateTime.Now.TimeOfDay, e.CloseReason);
                    header.ResetDropDown();
                }
                break;
            }
        }
        public StudyFilterColumnHeaderCell(DataGridViewColumnHeaderCell source)
            : this()
        {
            this.ErrorText        = source.ErrorText;
            this.Tag              = source.Tag;
            this.ToolTipText      = source.ToolTipText;
            this.Value            = source.Value;
            base.ContextMenuStrip = source.ContextMenuStrip;
            base.ValueType        = source.ValueType;

            // Avoid creating a new style object if the Style property has not previously been set.
            if (source.HasStyle)
            {
                base.Style = source.Style;
            }

            StudyFilterColumnHeaderCell typedSource = source as StudyFilterColumnHeaderCell;

            if (typedSource != null)
            {
                this._dropDownEnabled = typedSource._dropDownEnabled;
            }
        }
Exemplo n.º 8
0
		private void DataGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e)
		{
			if (!(e.Column.HeaderCell is StudyFilterColumnHeaderCell))
			{
				StudyFilterColumnHeaderCell header = new StudyFilterColumnHeaderCell(e.Column.HeaderCell);
				header.DropDownShown += HeaderCell_DropDownShown;
				header.DropDownHidden += HeaderCell_DropDownHidden;
				e.Column.SortMode = DataGridViewColumnSortMode.Programmatic;
				e.Column.HeaderCell = header;
			}
		}