public override void Select(AccessibleSelection flags)
            {
                if (base.Owner == null)
                {
                    throw new InvalidOperationException(System.Windows.Forms.SR.GetString("DataGridViewCellAccessibleObject_OwnerNotSet"));
                }
                DataGridViewColumnHeaderCell owner = (DataGridViewColumnHeaderCell)base.Owner;
                DataGridView dataGridView          = owner.DataGridView;

                if (dataGridView != null)
                {
                    if ((flags & AccessibleSelection.TakeFocus) == AccessibleSelection.TakeFocus)
                    {
                        dataGridView.FocusInternal();
                    }
                    if ((owner.OwningColumn != null) && ((dataGridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect) || (dataGridView.SelectionMode == DataGridViewSelectionMode.ColumnHeaderSelect)))
                    {
                        if ((flags & (AccessibleSelection.AddSelection | AccessibleSelection.TakeSelection)) != AccessibleSelection.None)
                        {
                            owner.OwningColumn.Selected = true;
                        }
                        else if ((flags & AccessibleSelection.RemoveSelection) == AccessibleSelection.RemoveSelection)
                        {
                            owner.OwningColumn.Selected = false;
                        }
                    }
                }
            }
            public override void Select(AccessibleSelection flags)
            {
                if (Owner == null)
                {
                    throw new InvalidOperationException(SR.DataGridViewCellAccessibleObject_OwnerNotSet);
                }

                DataGridViewColumnHeaderCell dataGridViewCell = (DataGridViewColumnHeaderCell)Owner;
                DataGridView dataGridView = dataGridViewCell.DataGridView;

                if (dataGridView == null)
                {
                    return;
                }
                if ((flags & AccessibleSelection.TakeFocus) == AccessibleSelection.TakeFocus)
                {
                    dataGridView.Focus();
                }
                if (dataGridViewCell.OwningColumn != null &&
                    (dataGridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect ||
                     dataGridView.SelectionMode == DataGridViewSelectionMode.ColumnHeaderSelect))
                {
                    if ((flags & (AccessibleSelection.TakeSelection | AccessibleSelection.AddSelection)) != 0)
                    {
                        dataGridViewCell.OwningColumn.Selected = true;
                    }
                    else if ((flags & AccessibleSelection.RemoveSelection) == AccessibleSelection.RemoveSelection)
                    {
                        dataGridViewCell.OwningColumn.Selected = false;
                    }
                }
            }
        /// <summary>
        /// Initializes a new instance of the DataGridViewColumnHeaderCell 
        /// class and sets its property values to the property values of the 
        /// specified DataGridViewColumnHeaderCell.
        /// </summary>
        /// <param name="oldHeaderCell">The DataGridViewColumnHeaderCell to copy property values from.</param>
        public DataGridViewAutoFilterFullColumnHeaderCell(DataGridViewColumnHeaderCell oldHeaderCell)
        {
            this.ContextMenuStrip = oldHeaderCell.ContextMenuStrip;
            this.ErrorText = oldHeaderCell.ErrorText;
            this.Tag = oldHeaderCell.Tag;
            this.ToolTipText = oldHeaderCell.ToolTipText;
            this.Value = oldHeaderCell.Value;
            this.ValueType = oldHeaderCell.ValueType;

            // Use HasStyle to avoid creating a new style object
            // when the Style property has not previously been set. 
            if (oldHeaderCell.HasStyle)
            {
                this.Style = oldHeaderCell.Style;
            }

            // Copy this type's properties if the old cell is an auto-filter cell. 
            // This enables the Clone method to reuse this constructor. 
            DataGridViewAutoFilterFullColumnHeaderCell filterCell =
                oldHeaderCell as DataGridViewAutoFilterFullColumnHeaderCell;
            if (filterCell != null)
            {
                this.FilteringEnabled = filterCell.FilteringEnabled;
                this.AutomaticSortingEnabled = filterCell.AutomaticSortingEnabled;
                this.DropDownListBoxMaxLines = filterCell.DropDownListBoxMaxLines;
                this.currentDropDownButtonPaddingOffset = 
                    filterCell.currentDropDownButtonPaddingOffset;
            }
        }
Пример #4
0
		public DataGridViewColumn () {
			cellTemplate = null;
			base.DefaultCellStyle = new DataGridViewCellStyle();
			readOnly = false;
			headerCell = new DataGridViewColumnHeaderCell();
			headerCell.SetColumnIndex(Index);
			headerCell.Value = string.Empty;
			displayIndex = -1;
			dataColumnIndex = -1;
			dataPropertyName = string.Empty;
			fillWeight = 100.0F;
			sortMode = DataGridViewColumnSortMode.NotSortable;
			SetState (DataGridViewElementStates.Visible);
		}
Пример #5
0
 public DataGridViewColumn()
 {
     cellTemplate          = null;
     base.DefaultCellStyle = new DataGridViewCellStyle();
     readOnly   = false;
     headerCell = new DataGridViewColumnHeaderCell();
     headerCell.SetColumnIndex(Index);
     headerCell.Value = string.Empty;
     displayIndex     = -1;
     dataColumnIndex  = -1;
     dataPropertyName = string.Empty;
     fillWeight       = 100.0F;
     sortMode         = DataGridViewColumnSortMode.NotSortable;
     SetState(DataGridViewElementStates.Visible);
 }
 public override object Clone()
 {
     DataGridViewColumnHeaderCell cell;
     System.Type type = base.GetType();
     if (type == cellType)
     {
         cell = new DataGridViewColumnHeaderCell();
     }
     else
     {
         cell = (DataGridViewColumnHeaderCell) Activator.CreateInstance(type);
     }
     base.CloneInternal(cell);
     cell.Value = base.Value;
     return cell;
 }
        public override object Clone()
        {
            DataGridViewColumnHeaderCell cell;

            System.Type type = base.GetType();
            if (type == cellType)
            {
                cell = new DataGridViewColumnHeaderCell();
            }
            else
            {
                cell = (DataGridViewColumnHeaderCell)Activator.CreateInstance(type);
            }
            base.CloneInternal(cell);
            cell.Value = base.Value;
            return(cell);
        }
Пример #8
0
        public SimpleDataGridViewColumn(
            DataGridViewAutoSizeColumnMode? autoSizeColumnMode,
            DataGridViewColumnHeaderCell headerCell,
            DataGridViewColumnSortMode? sortMode,
            Type defaultHeaderCellType, Type valueType,
            string dataPropertyName, string headerText, string name,
            int? dividerWidth, int? displayIndex, float? fillWeight, int? minWidth, int? width,
            DataGridViewCellStyle defaultCellStyle,
            bool resizable, bool? frozen, bool? readOnly, bool? visible)
        {
            InitializeNonVirtualProperties(
                autoSizeColumnMode, headerCell, sortMode,
                defaultHeaderCellType, valueType, dataPropertyName, headerText, name,
                dividerWidth, displayIndex, fillWeight, minWidth, width);

            InitializeVirtualProperties(defaultCellStyle, resizable, frozen, readOnly, visible);
        }
Пример #9
0
		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;
			}
		}
            public override void DoDefaultAction()
            {
                DataGridViewColumnHeaderCell owner = (DataGridViewColumnHeaderCell)base.Owner;
                DataGridView dataGridView          = owner.DataGridView;

                if (owner.OwningColumn != null)
                {
                    if (owner.OwningColumn.SortMode == DataGridViewColumnSortMode.Automatic)
                    {
                        ListSortDirection ascending = ListSortDirection.Ascending;
                        if ((dataGridView.SortedColumn == owner.OwningColumn) && (dataGridView.SortOrder == SortOrder.Ascending))
                        {
                            ascending = ListSortDirection.Descending;
                        }
                        dataGridView.Sort(owner.OwningColumn, ascending);
                    }
                    else if ((dataGridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect) || (dataGridView.SelectionMode == DataGridViewSelectionMode.ColumnHeaderSelect))
                    {
                        owner.OwningColumn.Selected = true;
                    }
                }
            }
        public dgvFilterColHeadCell(DataGridViewColumnHeaderCell oldHeaderCell, string _FilterType)
        {
            this.ContextMenuStrip = oldHeaderCell.ContextMenuStrip;
            this.ErrorText = oldHeaderCell.ErrorText;
            this.Tag = oldHeaderCell.Tag;
            this.ToolTipText = oldHeaderCell.ToolTipText;
            this.Value = oldHeaderCell.Value;
            this.ValueType = oldHeaderCell.ValueType;
            FilterType = _FilterType;

            if (oldHeaderCell.HasStyle)
            {
                this.Style = oldHeaderCell.Style;
            }
            ColumnDataName = oldHeaderCell.DataGridView.Columns[oldHeaderCell.ColumnIndex].DataPropertyName;
            ColumnName = oldHeaderCell.DataGridView.Columns[oldHeaderCell.ColumnIndex].Name;
            dgvFilterColHeadCell filterCell =
                oldHeaderCell as dgvFilterColHeadCell;
            if (filterCell != null)
            {
                this.FilteringEnabled = filterCell.FilteringEnabled;
                this.AutomaticSortingEnabled = filterCell.AutomaticSortingEnabled;
                this.DropDownListBoxMaxLines = filterCell.DropDownListBoxMaxLines;
                this.currentDropDownButtonPaddingOffset =
                    filterCell.currentDropDownButtonPaddingOffset;
                this.ucFilterTop = filterCell.ucFilterTop;
                this.eventFilterEx = filterCell.eventFilterEx;
            }
            if (_FilterType == ColFilterType.Check.ToString())
            {
                ucFilterTop = new UCCheckSelect();
            }
            else
            {
                ucFilterTop = new UCListSelect();
            }
            this.ucFilterTop.ColDataName = ColumnDataName;
        }
            public override void DoDefaultAction()
            {
                DataGridViewColumnHeaderCell dataGridViewCell = (DataGridViewColumnHeaderCell)Owner;
                DataGridView dataGridView = dataGridViewCell.DataGridView;

                if (dataGridViewCell.OwningColumn != null)
                {
                    if (dataGridViewCell.OwningColumn.SortMode == DataGridViewColumnSortMode.Automatic)
                    {
                        ListSortDirection listSortDirection = ListSortDirection.Ascending;
                        if (dataGridView.SortedColumn == dataGridViewCell.OwningColumn && dataGridView.SortOrder == SortOrder.Ascending)
                        {
                            listSortDirection = ListSortDirection.Descending;
                        }
                        dataGridView.Sort(dataGridViewCell.OwningColumn, listSortDirection);
                    }
                    else if (dataGridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect ||
                             dataGridView.SelectionMode == DataGridViewSelectionMode.ColumnHeaderSelect)
                    {
                        dataGridViewCell.OwningColumn.Selected = true;
                    }
                }
            }
Пример #13
0
 public void InitializeNonVirtualProperties(
     DataGridViewAutoSizeColumnMode? autoSizeColumnMode,
     DataGridViewColumnHeaderCell headerCell, 
     DataGridViewColumnSortMode? sortMode,
     Type defaultHeaderCellType, Type valueType, 
     string dataPropertyName, string headerText, string name,
     int? dividerWidth, int? displayIndex, float? fillWeight, int? minWidth, int? width)
 {
     this.AutoSizeMode = autoSizeColumnMode ?? DataGridViewAutoSizeColumnMode.AllCells;
     this.DataPropertyName = dataPropertyName ?? "Text";
     this.DividerWidth = dividerWidth ?? 2;
     this.DisplayIndex = displayIndex ?? _defaultDisplayIndex++;
     this.FillWeight = fillWeight ?? 10;
     this.HeaderCell = headerCell ?? new DataGridViewColumnHeaderCell();
     this.HeaderText = headerText;
     this.MinimumWidth = minWidth ?? 50;
     this.Width = width ?? 100;
     this.Name = name;
     this.SortMode = sortMode ?? DataGridViewColumnSortMode.Programmatic;
     this.DefaultHeaderCellType = defaultHeaderCellType ?? Type.GetType("string");
     this.ValueType = valueType ?? Type.GetType("string");
     
 }
 public DataGridViewColumnHeaderCellAccessibleObject(DataGridViewColumnHeaderCell owner) : base(owner)
 {
 }
Пример #15
0
 public DataGridViewColumnHeaderCellAccessibleObject(DataGridViewColumnHeaderCell owner)
 {
     throw null;
 }
Пример #16
0
 public abstract bool DataGridViewColumnHeaderCellDrawBackground(DataGridViewColumnHeaderCell cell, Graphics g, Rectangle_ bounds);
		static VisualStyleElement DataGridViewColumnHeaderCellGetVisualStyleElement (DataGridViewColumnHeaderCell cell)
		{
			if (cell.DataGridView.PressedHeaderCell == cell)
				return VisualStyleElement.Header.Item.Pressed;
			if (cell.DataGridView.EnteredHeaderCell == cell)
				return VisualStyleElement.Header.Item.Hot;
			return VisualStyleElement.Header.Item.Normal;
		}
Пример #18
0
		public abstract bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds);
		public override bool DataGridViewColumnHeaderCellDrawBackground (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds)
		{
			if (!RenderClientAreas ||
				!cell.DataGridView.EnableHeadersVisualStyles || cell is DataGridViewTopLeftHeaderCell)
				return base.DataGridViewColumnHeaderCellDrawBackground (cell, g, bounds);
			VisualStyleElement element = DataGridViewColumnHeaderCellGetVisualStyleElement (cell);
			if (!VisualStyleRenderer.IsElementDefined (element))
				return base.DataGridViewColumnHeaderCellDrawBackground (cell, g, bounds);
			bounds.Height--;
			VisualStyleRenderer renderer = new VisualStyleRenderer (element);
			if (!AreEqual (element, VisualStyleElement.Header.Item.Normal) && renderer.IsBackgroundPartiallyTransparent ())
			    new VisualStyleRenderer (VisualStyleElement.Header.Item.Normal).DrawBackground (g, bounds);
			renderer.DrawBackground (g, bounds);
			return true;
		}
		public override bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds)
		{
			if (!RenderClientAreas ||
				!cell.DataGridView.EnableHeadersVisualStyles ||
				cell is DataGridViewTopLeftHeaderCell ||
				!VisualStyleRenderer.IsElementDefined (VisualStyleElement.Header.Item.Normal))
				return base.DataGridViewColumnHeaderCellDrawBorder (cell, g, bounds);
			g.DrawLine (cell.GetBorderPen (), bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1);
			return true;
		}
        internal void OnSortGlyphDirectionChanged(DataGridViewColumnHeaderCell dataGridViewColumnHeaderCell)
        {
            Debug.Assert(dataGridViewColumnHeaderCell != null);

            if (dataGridViewColumnHeaderCell.OwningColumn == this.SortedColumn)
            {
                if (dataGridViewColumnHeaderCell.SortGlyphDirection == SortOrder.None)
                {
                    this.sortedColumn = null;
                    DataGridViewColumn dataGridViewColumn = dataGridViewColumnHeaderCell.OwningColumn;

                    if (dataGridViewColumn.IsDataBound)
                    {
                        // If the column whose SortGlyphChanges is the sorted column and it is also the dataBound column
                        // then see if there is another dataBound column which has the same property name as the sorted column.
                        // If so, then make that dataGridViewColumn the sorted column in the data grid view.
                        for (int i = 0; i < this.Columns.Count; i ++)
                        {
                            if (dataGridViewColumn != this.Columns[i] &&
                                this.Columns[i].SortMode != DataGridViewColumnSortMode.NotSortable &&
                                String.Compare(dataGridViewColumn.DataPropertyName,
                                               this.Columns[i].DataPropertyName,
                                               true /*ignoreCase*/,
                                               CultureInfo.InvariantCulture) == 0)
                            {
                                Debug.Assert(this.Columns[i].IsDataBound, "two columns w/ the same DataPropertyName should be DataBound at the same time");
                                this.sortedColumn = this.Columns[i];
                                break;
                            }
                        }
                    }
                }

                this.sortOrder = this.sortedColumn != null ? this.sortedColumn.HeaderCell.SortGlyphDirection : SortOrder.None;
            }

            InvalidateCellPrivate(dataGridViewColumnHeaderCell);
        }
        /// <include file='doc\DataGridViewColumnHeaderCell.uex' path='docs/doc[@for="DataGridViewColumnHeaderCell.Clone"]/*' />
        public override object Clone()
        {
            DataGridViewColumnHeaderCell dataGridViewCell;
            Type thisType = this.GetType();

            if (thisType == cellType) //performance improvement
            {
                dataGridViewCell = new DataGridViewColumnHeaderCell();
            }
            else
            {
                // SECREVIEW : Late-binding does not represent a security thread, see bug#411899 for more info..
                //
                dataGridViewCell = (DataGridViewColumnHeaderCell) System.Activator.CreateInstance(thisType);
            }
            base.CloneInternal(dataGridViewCell);
            dataGridViewCell.Value = this.Value;
            return dataGridViewCell;
        }
Пример #23
0
		public override bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds)
		{
			return false;
		}
Пример #24
0
 public DataGridViewColumnHeaderCellAccessibleObject(DataGridViewColumnHeaderCell owner) : base(owner)
 {
 }
Пример #25
0
        /// <summary>
        /// Initializes a new instance of the DataGridViewColumnHeaderCell 
        /// class and sets its property values to the property values of the 
        /// specified DataGridViewColumnHeaderCell.
        /// </summary>
        /// <param name="oldHeaderCell">The DataGridViewColumnHeaderCell to copy property values from.</param>
        public AutoFilterHeader(DataGridViewColumnHeaderCell oldHeaderCell)
        {
            //Image For Header Cell
            Assembly Asm = Assembly.GetExecutingAssembly();
            //Search Image Not Active
            string Resource_name1 = "ICTEAS.WinForms.Resources.search_22x22.png";
            Stream stream1 = Asm.GetManifestResourceStream(Resource_name1);
            _imgSearch = Image.FromStream(stream1);

            //Search Image Active
            string Resource_name2 = "ICTEAS.WinForms.Resources.search_Active.png";
            Stream stream2 = Asm.GetManifestResourceStream(Resource_name2);
            _imgSearchActive = Image.FromStream(stream2);

            //Search Image Mouse On
            string Resource_name3 = "ICTEAS.WinForms.Resources.searchMouseOn.gif";
            Stream stream3 = Asm.GetManifestResourceStream(Resource_name3);
            _imgSearchMouseIn = Image.FromStream(stream3);
            //Initialize Popup Controls
            //_popUp = new Popup(_popUpText = new ReadnSearchPopUp(oldHeaderCell.OwningColumn.HeaderText.ToString()));
            _popUp = new Popup(_popUpText = new ReadnSearchPopUp(this));
            _popUp.AutoClose = true;
            _popUp.FocusOnOpen = true;
            _popUp.DropShadowEnabled = true;
            _popUp.LostFocus += new EventHandler(_popUp_LostFocus);
            _popUp.Closing += new ToolStripDropDownClosingEventHandler(_popUp_Closing);

            this.Cntxtmenu = new System.Windows.Forms.ContextMenuStrip();
            this.tsRemoveFilter = new System.Windows.Forms.ToolStripMenuItem();

            this.Cntxtmenu.AllowDrop = true;
            this.Cntxtmenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tsRemoveFilter});
            this.Cntxtmenu.Name = "Cntxtmenu";
            this.Cntxtmenu.Size = new System.Drawing.Size(134, 136);
            // 
            // xport
            // 
            this.tsRemoveFilter.Name = "Remove Filter";
            this.tsRemoveFilter.Size = new System.Drawing.Size(133, 22);
            this.tsRemoveFilter.Text = "Remove Filter";
            this.tsRemoveFilter.Click += new EventHandler(tsRemoveFilter_Click);

            //this.ContextMenuStrip = oldHeaderCell.ContextMenuStrip;
            this.ContextMenuStrip = this.Cntxtmenu;
            this.ErrorText = oldHeaderCell.ErrorText;
            this.Tag = oldHeaderCell.Tag;
            this.ToolTipText = oldHeaderCell.ToolTipText;
            this.Value = oldHeaderCell.Value;
            this.ValueType = oldHeaderCell.ValueType;

            // Use HasStyle to avoid creating a new style object
            // when the Style property has not previously been set. 
            if (oldHeaderCell.HasStyle)
            {
                this.Style = oldHeaderCell.Style;
            }

            // Copy this type's properties if the old cell is an auto-filter cell. 
            // This enables the Clone method to reuse this constructor. 
            AutoFilterHeader filterCell =
                oldHeaderCell as AutoFilterHeader;
            if (filterCell != null)
            {
               this.FilteringEnabled = filterCell.FilteringEnabled;
                this.AutomaticSortingEnabled = filterCell.AutomaticSortingEnabled;
                this.DropDownListBoxMaxLines = filterCell.DropDownListBoxMaxLines;
                this.currentDropDownButtonPaddingOffset = 
                    filterCell.currentDropDownButtonPaddingOffset;
            }
            ContextMenuChangeState(filtered);
        }
Пример #26
0
 public abstract bool DataGridViewColumnHeaderCellDrawBorder(DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds);
Пример #27
0
 public static DataGridViewColumnHeaderCellCustom Clone(DataGridViewColumnHeaderCell hc)
 {
     //Had to build my own because DataGridViewColumnHeaderCellCustom's
     //clone didn't work.
     var toReturn = new DataGridViewColumnHeaderCellCustom();
     toReturn.ColumnIndex = hc.ColumnIndex;
     toReturn.SortGlyphDirection = hc.SortGlyphDirection;
     return toReturn;
 }