private void Select_Form_Load(object sender, EventArgs e) { c1FlexGrid1.Clear(); c1FlexGrid1.DataSource = null; c1FlexGrid1.ExtendLastCol = true; c1FlexGrid1.AutoResize = true; // add filter row FilterRow.FilterRow fr = new FilterRow.FilterRow(c1FlexGrid1); this.Location = new Point(_pt.X, _pt.Y); if (!_bIsConditionTable) { switch (_nType) { case (int)Definition.RoutingCommands.SHIFTSAMPLE: // shift sample case (int)Definition.RoutingCommands.CREATERESERVATION: // create reservation case (int)Definition.RoutingCommands.DELETERESERVATION: // delete reservation if (_parentGrid.ColSel == 2) { LoadPositionsToTable(true); } break; case (int)Definition.RoutingCommands.CREATESAMPLE: // create sample if (_parentGrid.ColSel == 2) { LoadPositionsToTable(true); } if (_parentGrid.ColSel == 3) { LoadSampleProgramsToTable(); } break; case (int)Definition.RoutingCommands.WRITEGLOBALTAG: // write WinCC global tags if (_parentGrid.ColSel == 4) { LoadWinCCGlobalTagsToTable(); } break; case (int)Definition.RoutingCommands.WRITEMACHINETAG: // write WinCC machine tags if (_parentGrid.ColSel == 4) { int nMachine_ID = -1; try { Int32.TryParse(_parentGrid[_parentGrid.RowSel, 3].ToString(), out nMachine_ID); } catch { } // MessageBox.Show(nMachine_ID.ToString()); LoadWinCCMachineTagsToTable(nMachine_ID); } break; case (int)Definition.RoutingCommands.INSERTWSENTRY: // INSERTWSENTRY load position to table // if (_parentGrid.ColSel == 3) { LoadPositionsToTable(true); } break; case (int)Definition.RoutingCommands.SENDINGCOMMANDTOMACHINE: // sending command to machine if (_parentGrid.ColSel == 2) { LoadMachinesToTable(); } if (_parentGrid.ColSel == 3) { LoadMachineCommandsToTable(); } break; default: break; } } else { switch (_nType) { case (int)Definition.RoutingConditions.SAMPLEONPOS: // sample on pos case (int)Definition.RoutingConditions.SAMPLEPRIORITY: // sample priority case (int)Definition.RoutingConditions.SAMPLETYPE: // sample type if (_parentGrid.ColSel == 3) { LoadPositionsToTable(true); } break; } } }
// ** ctor public MultiColumnEditor(C1FlexGrid flex, string keyColumn, bool bTranslate = false, bool bSetValue = true) { // some sanity if (!flex.Cols.Contains(keyColumn)) throw new ApplicationException(string.Format("Column '{0}' not found on the grid.", keyColumn)); // column that contains the value being edited _keyColumn = keyColumn; _bTranslate = bTranslate; _bSetValue = bSetValue; // initialize drop-down flex control _flex = flex; // _flex.Cols.Fixed = 1; _flex.Rows.Fixed = 1; _flex.Cols[0].Width = _flex.Font.Height; _flex.ShowCursor = true; _flex.AllowFiltering = true; _flex.AllowEditing = false; _flex.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.FixedSingle; _flex.VisualStyle = VisualStyle.Office2007Blue; _flex.TabStop = false; _flex.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.None; _flex.SelectionMode = SelectionModeEnum.Row; //_flex.FocusRect = FocusRectEnum.None; _flex.AutoSearch = AutoSearchEnum.FromCursor; _flex.EditOptions = EditFlags.None; //_flex.Click += new EventHandler(_flex_Click); _flex.DoubleClick += new EventHandler(_flex_DoubleClick); _flex.KeyPress += new KeyPressEventHandler(_flex_KeyPress); // if (bTranslate) { _flex.Cols[1].Visible = false; // } fr = new FilterRow.FilterRow(_flex); // _flex.Select(1, _flex.Cols.Fixed); }