private void fileContentDataGrid_ColumnDividerDoubleClick(Object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
     e.Handled = true;
     //// get mouse coordinates
     //System.Drawing.Point mousePoint = fileContentDataGrid.PointToClient(Cursor.Position);
     //DataGridView.HitTestInfo hitTestInfo = fileContentDataGrid.HitTest(mousePoint.X, mousePoint.Y);
     //// need to use reflection here to get access to the typeInternal field value which is declared as internal
     //FieldInfo fieldInfo = hitTestInfo.GetType().GetField("typeInternal",
     //    BindingFlags.Instance | BindingFlags.NonPublic);
     //string value = fieldInfo.GetValue(hitTestInfo).ToString();
     //throw new Exception(value);
     //if (value.Contains("Resize"))
     //{
     //    // one of resize areas is double clicked; stop processing here
     //    return;
     //}
     //else
     //{
     //    // continue normal processing of the cell double click event
     //}
 }
예제 #2
0
		protected virtual void OnColumnDividerDoubleClick (DataGridViewColumnDividerDoubleClickEventArgs e)
		{
			DataGridViewColumnDividerDoubleClickEventHandler eh = (DataGridViewColumnDividerDoubleClickEventHandler)(Events [ColumnDividerDoubleClickEvent]);
			if (eh != null)
				eh (this, e);
		}
예제 #3
0
 void FilterGridView_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
     e.Handled = true;
     Action<DataGridView> fx = AutoResizeColumns;
     BeginInvoke(fx, new object[] { filterGridView });
 }
예제 #4
0
 void DataGridView_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
     e.Handled = true;
     AutoResizeColumns(dataGridView);
 }
예제 #5
0
		private void boomarkDataGridView_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
		{
			e.Handled = true;
			ResizeColumns();
		}
예제 #6
0
 private void SearchResults_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
     SearchResults.AutoResizeColumn(e.ColumnIndex, DataGridViewAutoSizeColumnMode.AllCells);
 }
예제 #7
0
 /// <summary>
 /// Measure Text and set Column Width on Double-Click
 /// </summary>
 private void DataGridViewColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
    AutoSizeColumn(e.ColumnIndex);
    e.Handled = true;
 }
        /// <include file='doc\DataGridView.uex' path='docs/doc[@for="DataGridView.OnMouseDoubleClick"]/*' />
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            base.OnMouseDoubleClick(e);

            if (!this.dataGridViewState2[DATAGRIDVIEWSTATE2_messageFromEditingCtrls] &&
                !this.dataGridViewOper[DATAGRIDVIEWOPER_trackColResize] && 
                !this.dataGridViewOper[DATAGRIDVIEWOPER_trackRowResize] && 
                !this.dataGridViewOper[DATAGRIDVIEWOPER_trackColHeadersResize] && 
                !this.dataGridViewOper[DATAGRIDVIEWOPER_trackRowHeadersResize])
            {
                HitTestInfo hti = HitTest(e.X, e.Y);

                if (this.ptMouseDownCell.X == hti.col && this.ptMouseDownCell.Y == hti.row)
                {
                    DataGridViewCellMouseEventArgs dgvcme = null;
                    if (hti.Type != DataGridViewHitTestType.None && 
                        hti.Type != DataGridViewHitTestType.HorizontalScrollBar && 
                        hti.Type != DataGridViewHitTestType.VerticalScrollBar)
                    {
                        int mouseX = e.X - hti.ColumnX;
                        if (this.RightToLeftInternal)
                        {
                            mouseX += ((hti.col == -1) ? this.RowHeadersWidth : this.Columns[hti.col].Thickness);
                        }
                        dgvcme = new DataGridViewCellMouseEventArgs(hti.col, hti.row, mouseX, e.Y - hti.RowY, e);
                        OnCellMouseDoubleClick(dgvcme);
                    }

                    if (!this.dataGridViewOper[DATAGRIDVIEWOPER_trackColRelocation])
                    {
                        switch (hti.typeInternal)
                        {
                            case DataGridViewHitTestTypeInternal.ColumnHeader:
                            case DataGridViewHitTestTypeInternal.ColumnHeaderLeft:
                            case DataGridViewHitTestTypeInternal.ColumnHeaderRight:
                            case DataGridViewHitTestTypeInternal.FirstColumnHeaderLeft:
                            {
                                Debug.Assert(dgvcme != null);
                                if (dgvcme.ColumnIndex < this.Columns.Count && dgvcme.RowIndex < this.Rows.Count)
                                {
                                    OnColumnHeaderMouseDoubleClick(dgvcme);
                                }
                                break;
                            }

                            case DataGridViewHitTestTypeInternal.ColumnResizeLeft:
                            case DataGridViewHitTestTypeInternal.ColumnResizeRight:
                            {
                                int columnIndex = (hti.typeInternal == DataGridViewHitTestTypeInternal.ColumnResizeRight) ? hti.col : hti.adjacentCol;
                                if (columnIndex < this.Columns.Count)
                                {
                                    HandledMouseEventArgs hme = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false /*defaultHandledValue*/);
                                    DataGridViewColumnDividerDoubleClickEventArgs dgvcddce = new DataGridViewColumnDividerDoubleClickEventArgs(columnIndex, hme);
                                    Debug.Assert(this.Columns[columnIndex].Resizable == DataGridViewTriState.True);
                                    OnColumnDividerDoubleClick(dgvcddce);
                                }
                                break;
                            }
    
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeTop:
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeBottom:
                            case DataGridViewHitTestTypeInternal.ColumnHeadersResizeTop:
                            case DataGridViewHitTestTypeInternal.ColumnHeadersResizeBottom:
                            {
                                HandledMouseEventArgs hme = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false /*defaultHandledValue*/);
                                DataGridViewRowDividerDoubleClickEventArgs dgvrddce = new DataGridViewRowDividerDoubleClickEventArgs(-1, hme);
                                Debug.Assert(this.columnHeadersHeightSizeMode == DataGridViewColumnHeadersHeightSizeMode.EnableResizing);
                                OnRowDividerDoubleClick(dgvrddce);
                                break;
                            }

                            case DataGridViewHitTestTypeInternal.RowHeader:
                            {
                                Debug.Assert(dgvcme != null);
                                if (dgvcme.ColumnIndex < this.Columns.Count && dgvcme.RowIndex < this.Rows.Count)
                                {
                                    OnRowHeaderMouseDoubleClick(dgvcme);
                                }
                                break;
                            }

                            case DataGridViewHitTestTypeInternal.RowResizeBottom:
                            case DataGridViewHitTestTypeInternal.RowResizeTop:
                            {
                                int rowIndex = (hti.typeInternal == DataGridViewHitTestTypeInternal.RowResizeBottom) ? hti.row : hti.adjacentRow;
                                if (rowIndex < this.Rows.Count)
                                {
                                    HandledMouseEventArgs hme = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false /*defaultHandledValue*/);
                                    DataGridViewRowDividerDoubleClickEventArgs dgvrddce = new DataGridViewRowDividerDoubleClickEventArgs(rowIndex, hme);
                                    Debug.Assert(this.Rows[rowIndex].Resizable == DataGridViewTriState.True);
                                    OnRowDividerDoubleClick(dgvrddce);
                                }
                                break;
                            }

                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeLeft:
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeRight:
                            case DataGridViewHitTestTypeInternal.RowHeadersResizeLeft:
                            case DataGridViewHitTestTypeInternal.RowHeadersResizeRight:
                            {
                                HandledMouseEventArgs hme = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false /*defaultHandledValue*/);
                                DataGridViewColumnDividerDoubleClickEventArgs dgvcddce = new DataGridViewColumnDividerDoubleClickEventArgs(-1, hme);
                                Debug.Assert(this.rowHeadersWidthSizeMode == DataGridViewRowHeadersWidthSizeMode.EnableResizing);
                                OnColumnDividerDoubleClick(dgvcddce);
                                break;
                            }
                        }
                    }
                }
            }
        }
        /// <include file='doc\DataGridView.uex' path='docs/doc[@for="DataGridView.OnColumnDividerDoubleClick"]/*' />
        protected virtual void OnColumnDividerDoubleClick(DataGridViewColumnDividerDoubleClickEventArgs e)
        {
            DataGridViewColumnDividerDoubleClickEventHandler eh = this.Events[EVENT_DATAGRIDVIEWCOLUMNDIVIDERDOUBLECLICK] as DataGridViewColumnDividerDoubleClickEventHandler;
            if (eh != null && !this.dataGridViewOper[DATAGRIDVIEWOPER_inDispose] && !this.IsDisposed)
            {
                eh(this, e);
            }

            if (!e.Handled && e.Button == MouseButtons.Left && e.ColumnIndex < this.Columns.Count)
            {
                if (e.ColumnIndex == -1)
                {
                    AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders,
                                              true /*fixedColumnHeadersHeight*/,
                                              true /*fixedRowsHeight*/);
                }
                else
                {
                    DataGridViewAutoSizeColumnMode inheritedAutoSizeMode = this.Columns[e.ColumnIndex].InheritedAutoSizeMode;
                    if (inheritedAutoSizeMode == DataGridViewAutoSizeColumnMode.None || inheritedAutoSizeMode == DataGridViewAutoSizeColumnMode.Fill)
                    {
                        AutoResizeColumnInternal(e.ColumnIndex, DataGridViewAutoSizeColumnCriteriaInternal.Header | DataGridViewAutoSizeColumnCriteriaInternal.AllRows, true /*fixedHeight*/);
                    }
                    else
                    {
                        AutoResizeColumnInternal(e.ColumnIndex, (DataGridViewAutoSizeColumnCriteriaInternal)inheritedAutoSizeMode, true /*fixedHeight*/);
                    }
                }
            }
        }
예제 #10
0
 private void DataGridViewDisplays_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
 {
 }
 protected virtual void OnColumnDividerDoubleClick(DataGridViewColumnDividerDoubleClickEventArgs e);
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            base.OnMouseDoubleClick(e);
            if (((!this.dataGridViewState2[0x8000000] && !this.dataGridViewOper[1]) && (!this.dataGridViewOper[2] && !this.dataGridViewOper[0x80])) && !this.dataGridViewOper[0x100])
            {
                HitTestInfo info = this.HitTest(e.X, e.Y);
                if ((this.ptMouseDownCell.X == info.col) && (this.ptMouseDownCell.Y == info.row))
                {
                    DataGridViewCellMouseEventArgs args = null;
                    if (((info.Type != DataGridViewHitTestType.None) && (info.Type != DataGridViewHitTestType.HorizontalScrollBar)) && (info.Type != DataGridViewHitTestType.VerticalScrollBar))
                    {
                        int localX = e.X - info.ColumnX;
                        if (this.RightToLeftInternal)
                        {
                            localX += (info.col == -1) ? this.RowHeadersWidth : this.Columns[info.col].Thickness;
                        }
                        args = new DataGridViewCellMouseEventArgs(info.col, info.row, localX, e.Y - info.RowY, e);
                        this.OnCellMouseDoubleClick(args);
                    }
                    if (!this.dataGridViewOper[0x20])
                    {
                        switch (info.typeInternal)
                        {
                            case DataGridViewHitTestTypeInternal.ColumnHeader:
                            case DataGridViewHitTestTypeInternal.FirstColumnHeaderLeft:
                            case DataGridViewHitTestTypeInternal.ColumnHeaderLeft:
                            case DataGridViewHitTestTypeInternal.ColumnHeaderRight:
                                if ((args.ColumnIndex < this.Columns.Count) && (args.RowIndex < this.Rows.Count))
                                {
                                    this.OnColumnHeaderMouseDoubleClick(args);
                                }
                                return;

                            case DataGridViewHitTestTypeInternal.RowHeader:
                                if ((args.ColumnIndex < this.Columns.Count) && (args.RowIndex < this.Rows.Count))
                                {
                                    this.OnRowHeaderMouseDoubleClick(args);
                                }
                                return;

                            case DataGridViewHitTestTypeInternal.ColumnResizeLeft:
                            case DataGridViewHitTestTypeInternal.ColumnResizeRight:
                            {
                                int columnIndex = (info.typeInternal == DataGridViewHitTestTypeInternal.ColumnResizeRight) ? info.col : info.adjacentCol;
                                if (columnIndex < this.Columns.Count)
                                {
                                    HandledMouseEventArgs args2 = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false);
                                    DataGridViewColumnDividerDoubleClickEventArgs args3 = new DataGridViewColumnDividerDoubleClickEventArgs(columnIndex, args2);
                                    this.OnColumnDividerDoubleClick(args3);
                                }
                                return;
                            }
                            case DataGridViewHitTestTypeInternal.RowResizeTop:
                            case DataGridViewHitTestTypeInternal.RowResizeBottom:
                            {
                                int rowIndex = (info.typeInternal == DataGridViewHitTestTypeInternal.RowResizeBottom) ? info.row : info.adjacentRow;
                                if (rowIndex < this.Rows.Count)
                                {
                                    HandledMouseEventArgs args6 = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false);
                                    DataGridViewRowDividerDoubleClickEventArgs args7 = new DataGridViewRowDividerDoubleClickEventArgs(rowIndex, args6);
                                    this.OnRowDividerDoubleClick(args7);
                                }
                                return;
                            }
                            case DataGridViewHitTestTypeInternal.TopLeftHeader:
                                return;

                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeLeft:
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeRight:
                            case DataGridViewHitTestTypeInternal.RowHeadersResizeRight:
                            case DataGridViewHitTestTypeInternal.RowHeadersResizeLeft:
                            {
                                HandledMouseEventArgs args8 = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false);
                                DataGridViewColumnDividerDoubleClickEventArgs args9 = new DataGridViewColumnDividerDoubleClickEventArgs(-1, args8);
                                this.OnColumnDividerDoubleClick(args9);
                                return;
                            }
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeTop:
                            case DataGridViewHitTestTypeInternal.TopLeftHeaderResizeBottom:
                            case DataGridViewHitTestTypeInternal.ColumnHeadersResizeBottom:
                            case DataGridViewHitTestTypeInternal.ColumnHeadersResizeTop:
                            {
                                HandledMouseEventArgs args4 = new HandledMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta, false);
                                DataGridViewRowDividerDoubleClickEventArgs args5 = new DataGridViewRowDividerDoubleClickEventArgs(-1, args4);
                                this.OnRowDividerDoubleClick(args5);
                                return;
                            }
                        }
                    }
                }
            }
        }
 protected virtual void OnColumnDividerDoubleClick(DataGridViewColumnDividerDoubleClickEventArgs e)
 {
     DataGridViewColumnDividerDoubleClickEventHandler handler = base.Events[EVENT_DATAGRIDVIEWCOLUMNDIVIDERDOUBLECLICK] as DataGridViewColumnDividerDoubleClickEventHandler;
     if (((handler != null) && !this.dataGridViewOper[0x100000]) && !base.IsDisposed)
     {
         handler(this, e);
     }
     if ((!e.Handled && (e.Button == MouseButtons.Left)) && (e.ColumnIndex < this.Columns.Count))
     {
         if (e.ColumnIndex == -1)
         {
             this.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders, true, true);
         }
         else
         {
             DataGridViewAutoSizeColumnMode inheritedAutoSizeMode = this.Columns[e.ColumnIndex].InheritedAutoSizeMode;
             switch (inheritedAutoSizeMode)
             {
                 case DataGridViewAutoSizeColumnMode.None:
                 case DataGridViewAutoSizeColumnMode.Fill:
                     this.AutoResizeColumnInternal(e.ColumnIndex, DataGridViewAutoSizeColumnCriteriaInternal.AllRows | DataGridViewAutoSizeColumnCriteriaInternal.Header, true);
                     return;
             }
             this.AutoResizeColumnInternal(e.ColumnIndex, (DataGridViewAutoSizeColumnCriteriaInternal) inheritedAutoSizeMode, true);
         }
     }
 }
예제 #14
0
		private void patternHitsDataGridView_ColumnDividerDoubleClick(object sender, DataGridViewColumnDividerDoubleClickEventArgs e)
		{
			e.Handled = true;
			this.patternHitsDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
		}
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// datagridviewcolumndividerdoubleclickeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this DataGridViewColumnDividerDoubleClickEventHandler datagridviewcolumndividerdoubleclickeventhandler, Object sender, DataGridViewColumnDividerDoubleClickEventArgs e, AsyncCallback callback)
        {
            if(datagridviewcolumndividerdoubleclickeventhandler == null) throw new ArgumentNullException("datagridviewcolumndividerdoubleclickeventhandler");

            return datagridviewcolumndividerdoubleclickeventhandler.BeginInvoke(sender, e, callback, null);
        }