Ejemplo n.º 1
0
        private void bandedGridView1_MouseDown(object sender, MouseEventArgs e)
        {
            if (Control.ModifierKeys != (Keys.Shift | Keys.Control))
            {
                return;
            }
            BandedGridView    view  = (BandedGridView)sender;
            BandedGridHitInfo hInfo = view.CalcHitInfo(e.Location);

            if (hInfo.InColumn)
            {
                view.ClearSelection();
                SelectCells(hInfo.Column);
            }
            else if (hInfo.InBandPanel && hInfo.Band != null)
            {
                view.ClearSelection();
                SelectCells(hInfo.Band);
            }
            else
            {
                return;
            }
            ((DXMouseEventArgs)e).Handled = true;
        }
Ejemplo n.º 2
0
        public static void ClearSelection(BaseView baseView)
        {
            switch (baseView.GetType().Name)
            {
            case "BandedGridView":

                BandedGridView bView = baseView as BandedGridView;
                bView.OptionsView.NewItemRowPosition = NewItemRowPosition.Top;
                bView.FocusedRowHandle = GridControl.NewItemRowHandle;
                bView.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
                //bView.OptionsSelection.EnableAppearanceFocusedRow = false;
                bView.ClearSelection();

                break;

            case "GridView":
                GridView gView = baseView as GridView;
                gView.OptionsView.NewItemRowPosition = NewItemRowPosition.Top;
                gView.FocusedRowHandle = GridControl.NewItemRowHandle;
                gView.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
                //gView.OptionsSelection.EnableAppearanceFocusedRow = false;
                gView.ClearSelection();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Activate editor for cell
        /// </summary>
        /// <param name="r"></param>
        /// <param name="c"></param>

        private void EditCellValue(
            int r,
            int c)
        {
            BandedGridView bgv = RulesGrid.MainView as BandedGridView;

            bgv.ClearSelection();
            bgv.SelectCell(r, bgv.Columns[c]);
            bgv.FocusedRowHandle = r;
            bgv.FocusedColumn    = bgv.Columns[c];
            bgv.ShowEditor();             // doesn't seem to open dropdown
            //Application.DoEvents();

            //ColorDialog cd = new ColorDialog();
            //cd.Color = RulesGrid.GetCellBackColor(r, BackColorCol);
            //DialogResult dr = cd.ShowDialog(this);
            //if (dr != DialogResult.OK) return;

            //CellInfo ci = RulesGrid.GetCellInfo(r, c);
            //RulesGrid.DataTable.Rows[ci.DataRowIndex][ci.DataColIndex] = cd.Color;
            //bgv.RefreshRowCell(r, ci.GridColumn);

            //RulesGrid.AddNewRowAsNeeded();
            return;
        }
Ejemplo n.º 4
0
        public void Setup(
            MoleculeList structureList,
            ListItemSelectedDelegate itemSelectedCallback)
        {
            DataTableMx dt;
            DataRowMx   dr;

            InSetup = true;

            StructureList            = structureList;
            ListItemSelectedCallback = itemSelectedCallback;

// Create DataTable if not done yet

            if (DataTable == null)
            {
                dt        = new DataTableMx();
                DataTable = dt;                 // save ref to table
                dt.Columns.Add("NameCol", typeof(string));
                dt.Columns.Add("StructureCol", typeof(MoleculeMx));
                dt.Columns.Add("DateCol", typeof(DateTime));
                dt.Columns.Add("StructureTypeCol", typeof(string));

                MoleculeGrid.SetupDefaultQueryManager(dt);                 // setup underlying QueryManager/QueryTable for current type
                MoleculeGrid.SetupUnboundColumns(dt);
            }

            dt = DataTable;

// Add rows to DataTable

            bool saveEnabled = dt.EnableDataChangedEventHandlers(false);             // turn off change events while filling

            if (structureList == null)
            {
                InSetup = false; return;
            }

            for (int ri = 0; ri < structureList.Count; ri++)             // fill in the grid
            {
                MoleculeListItem sli = structureList[ri];

                dr = dt.NewRow();

                dr["NameCol"]          = sli.Name;
                dr["StructureCol"]     = sli.Molecule;
                dr["DateCol"]          = sli.UpdateDate;
                dr["StructureTypeCol"] = sli.MoleculeType;

                dt.Rows.Add(dr);
            }

            MoleculeGrid.DataSource = dt;             // make the data visible
            BandedGridView.ClearSelection();
            dt.EnableDataChangedEventHandlers(saveEnabled);
            InSetup = false;
            return;
        }