/// <summary>
        /// 行の境界線がダブルクリックされた時
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        protected override void OnRowDividerDoubleClick(System.Windows.Forms.DataGridViewRowDividerDoubleClickEventArgs e)
        {
            base.OnRowDividerDoubleClick(e);

            try
            {
                //行ヘッダーの境界線がダブルクリックされたへっだーの高さを整える
                if (e.RowIndex == -1)
                {
                    base.ColumnHeadersHeight = this.ColumnHeaderRowCount * this.ColumnHeaderRowHeight + 2;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
		protected virtual void OnRowDividerDoubleClick (DataGridViewRowDividerDoubleClickEventArgs e)
		{
			DataGridViewRowDividerDoubleClickEventHandler eh = (DataGridViewRowDividerDoubleClickEventHandler)(Events [RowDividerDoubleClickEvent]);
			if (eh != null) eh (this, e);
		}
Exemple #3
0
 private void dataGridView1_RowDividerDoubleClick(object sender, DataGridViewRowDividerDoubleClickEventArgs e)
 {
     int x = 0;
 }
 private void gvPedidos_RowDividerDoubleClick(object sender, DataGridViewRowDividerDoubleClickEventArgs e)
 {
 }
        /// <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.OnRowDividerDoubleClick"]/*' />
        protected virtual void OnRowDividerDoubleClick(DataGridViewRowDividerDoubleClickEventArgs e)
        {
            DataGridViewRowDividerDoubleClickEventHandler eh = this.Events[EVENT_DATAGRIDVIEWROWDIVIDERDOUBLECLICK] as DataGridViewRowDividerDoubleClickEventHandler;
            if (eh != null && !this.dataGridViewOper[DATAGRIDVIEWOPER_inDispose] && !this.IsDisposed)
            {
                eh(this, e);
            }

            if (!e.Handled && e.Button == MouseButtons.Left && e.RowIndex < this.Rows.Count)
            {
                if (e.RowIndex == -1)
                {
                    AutoResizeColumnHeadersHeight(true /*fixedRowHeadersWidth*/, true /*fixedColumnsWidth*/);
                }
                else
                {
                    if (this.autoSizeRowsMode == DataGridViewAutoSizeRowsMode.None)
                    {
                        AutoResizeRowInternal(e.RowIndex, DataGridViewAutoSizeRowMode.AllCells, true /*fixedWidth*/, true /*internalAutosizing*/);
                    }
                    else
                    {
                        AutoResizeRowInternal(e.RowIndex, MapAutoSizeRowsModeToRowMode(this.autoSizeRowsMode), true /*fixedWidth*/, true /*internalAutosizing*/);
                    }
                }
            }
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// datagridviewrowdividerdoubleclickeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this DataGridViewRowDividerDoubleClickEventHandler datagridviewrowdividerdoubleclickeventhandler, Object sender, DataGridViewRowDividerDoubleClickEventArgs e, AsyncCallback callback)
        {
            if(datagridviewrowdividerdoubleclickeventhandler == null) throw new ArgumentNullException("datagridviewrowdividerdoubleclickeventhandler");

            return datagridviewrowdividerdoubleclickeventhandler.BeginInvoke(sender, e, callback, null);
        }
 private void dtgvData_RowDividerDoubleClick(object sender, DataGridViewRowDividerDoubleClickEventArgs e)
 {
 }
 protected virtual void OnRowDividerDoubleClick(DataGridViewRowDividerDoubleClickEventArgs 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;
                            }
                        }
                    }
                }
            }
        }
Exemple #11
0
 //-------------------------------------------------------------------------------------
 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 protected override void OnRowDividerDoubleClick(DataGridViewRowDividerDoubleClickEventArgs e)
 {
  base.OnRowDividerDoubleClick(e);
  ControlInfo ci = GetControl(e.RowIndex);
  if(ci == null || ci.Control == null || ci.Opened == false)
   return;
  this.Rows[e.RowIndex].Height = 
   RowTemplate.Height + 
   (ci.Control.PreferredSize.Height > cMaxHeight ? cMaxHeight : ci.Control.PreferredSize.Height); 
  ci.Height = 0;
 }