Exemplo n.º 1
0
 private void SetOwnerItem(Control control)
 {
     if (control == null)
     {
         return;
     }
     if (control is Popup)
     {
         Popup popupControl = control as Popup;
         ownerPopup = popupControl;
         ownerPopup.childPopup = this;
         OwnerItem = popupControl.Items[0];
         return;
     }
     if (control.Parent != null)
     {
         SetOwnerItem(control.Parent);
     }
 }
Exemplo n.º 2
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);
        }
 public void OnFilterRemoved(DataGridView parentGrid, int _ColumnIndex, int _RowIndex, Popup _popup)
 {
     _DgView = parentGrid;
     _CurrentColumnIndex = _ColumnIndex;
     _popup.OnFilterRemoved(_DgView);
 }
 public void ShowSearch(DataGridView parentGrid, int _ColumnIndex, int _RowIndex,Popup _popup)
 {
     _DgView = parentGrid;
     _CurrentColumnIndex = _ColumnIndex;
     Rectangle Rect = _DgView.GetCellDisplayRectangle(_ColumnIndex, _RowIndex, false);
     Rectangle RectToDiplay = new Rectangle(Rect.X, Rect.Y - this.ClientRectangle.Height, this.ClientRectangle.Width, this.ClientRectangle.Height);
     _popup.Show(_DgView, RectToDiplay);
 }
Exemplo n.º 5
0
        //public void ShowSearch(DataGridView parentGrid, int _ColumnIndex, int _RowIndex,Popup _popup)
        //{
        //    _DgView = parentGrid;
        //    _CurrentColumnIndex = _ColumnIndex;
        //    Rectangle Rect = _DgView.GetCellDisplayRectangle(_ColumnIndex, _RowIndex,false );
        //    Rectangle RectToDiplay = new Rectangle(Rect.X, Rect.Y - this.ClientRectangle.Height, this.ClientRectangle.Width, this.ClientRectangle.Height);
        //    //if (RectToDiplay.X < 0)
        //    //    RectToDiplay.X = 0;
        //    //if (RectToDiplay.Y < 0)
        //    //    RectToDiplay.Y = 0;
        //    _popup.Show(_DgView, RectToDiplay);
        //}
        public void ShowSearch(DataGridView parentGrid, int _ColumnIndex, int _RowIndex, Popup _popup,bool OpenOnRight)
        {
            _DgView = parentGrid;
            _CurrentColumnIndex = _ColumnIndex;
            Rectangle Rect = _DgView.GetCellDisplayRectangle(_ColumnIndex, _RowIndex, false);
            //if (OpenOnRight)
            //{
            //    Rectangle RectToDiplay = new Rectangle(Rect.Right - this.ClientRectangle.Width, Rect.Y - this.ClientRectangle.Height, this.ClientRectangle.Width, this.ClientRectangle.Height);
            //    _popup.Show(_DgView, RectToDiplay);

            //}
            //else
            //{

                Rectangle RectToDiplay = new Rectangle(Rect.X, Rect.Y - this.ClientRectangle.Height, this.ClientRectangle.Width, this.ClientRectangle.Height);
                _popup.Show(_DgView, RectToDiplay);
            //}
        }