Ejemplo n.º 1
0
        private void m_grid_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                C2iWndDataGridColumn col = m_wndGrid.GetColumn(e.ColumnIndex);
                Rectangle            rct = m_grid.GetColumnDisplayRectangle(e.ColumnIndex, false);
                if (e.X > rct.Width - c_nWidthImageHeader)//Filtre
                {
                    if (col != null && col.AllowFilter)
                    {
                        FillMenuFiltre(e.ColumnIndex, col);
                        DataGridViewColumn gvCol = m_grid.Columns[e.ColumnIndex];
                        rct        = m_grid.GetColumnDisplayRectangle(e.ColumnIndex, true);
                        rct.Height = gvCol.HeaderCell.ContentBounds.Height;

                        m_menuFiltre.Show(m_grid, rct.Left, rct.Bottom);

                        /*}
                         * else
                         * {
                         *  string strText = null;
                         *  if (!m_dicFiltre.TryGetValue(e.ColumnIndex, out strText))
                         *      strText = "";
                         *  CFormFiltreDataGrid.OnFiltrerDataGridEventHandler handler = new CFormFiltreDataGrid.OnFiltrerDataGridEventHandler(OnFiltrer);
                         *  CFormFiltreDataGrid.Show(col, e.ColumnIndex, strText, rct.Width, handler);
                         * }*/
                    }
                }
                else
                {
                    if (col != null && col.AllowSort)
                    {
                        Sort(e.ColumnIndex);
                    }
                }
            }
        }