public FormLogs(IApplicationController controller, StratumModel stratum) : base() { this.Controller = controller; InitializeComponent(); this.KeyPreview = true; if (ViewController.PlatformType == PlatformType.WinCE) { this.WindowState = FormWindowState.Maximized; this._ceControlPanel.Visible = true; this.Menu = null; this.mainMenu1.Dispose(); this.mainMenu1 = null; } else if (ViewController.PlatformType == PlatformType.WM) { this._sip = new Microsoft.WindowsCE.Forms.InputPanel(); this.components.Add(_sip); this._dataGrid.SIP = this._sip; } this._dataGrid.CellValidating += new EditableDataGridCellValidatingEventHandler(_dataGrid_CellValidating); DataGridAdjuster.InitializeGrid(this._dataGrid); DataGridTableStyle tableStyle = DataGridAdjuster.InitializeLogColumns(stratum, _dataGrid); _logNumColumn = tableStyle.GridColumnStyles[CruiseDAL.Schema.LOG.LOGNUMBER] as EditableTextBoxColumn; }
public Form1() { InitializeComponent(); // tell our form that we want to intercept all key press events in our form.Otherwise our KeyPress event method will only get events when the form class has focus. //this.KeyPreview = true; //give our dataGrid our SIP, so that I can listen and react to events on our SIP editableDataGrid1.SIP = inputPanel1; editableDataGrid1.CellValidating += new EditableDataGridCellValidatingEventHandler(editableDataGrid1_CellValidating); editableDataGrid1.CellValueChanged += new EditableDataGridCellValueChangedEventHandler(editableDataGrid1_CellValueChanged); buttonPanel1.Text = "something"; ////allow new rows on datagrid //editableDataGrid1.AllowNewRow = true; //set up columns for our dataGrid DataGridTableStyle ts = new DataGridTableStyle() { MappingName = "something" }; comboBoxCol = new EditableComboBoxColumn() { MappingName = "num1" }; textBoxCol = new EditableTextBoxColumn() { MappingName = "word", MaxTextLength = 12, GoToNextColumnWhenTextCompleate = true }; dateTimeCol = new EditableDateTimePickerColumn() { MappingName = "date" }; upDwnCol = new EditableUpDownColumn() { MappingName = "upDwn" }; ts.GridColumnStyles.Add(comboBoxCol); ts.GridColumnStyles.Add(textBoxCol); ts.GridColumnStyles.Add(dateTimeCol); ts.GridColumnStyles.Add(upDwnCol); //set up our button column and give it a event handler for button clicks //note the mapping name for the buttonColumn must be provided and a valid property to bind to //this is because the dataGrid only displays columns that have a valid MappingName //I've created a work around that should work for Full Framework, and will probably be able to make a workaround for Mobile //, but until then provide a mapping name. //For DAL DataObjects you could use the Tag property as a mapping name, since it isn't reserved for any propuse, and is intended for special cases like this. DataGridButtonColumn buttonCol = new DataGridButtonColumn() { MappingName = "button", UseCellColumnTextForCellValue = true, Text = "click me" }; buttonCol.Click += new ButtonCellClickEventHandler(buttonCol_Click); ts.GridColumnStyles.Add(buttonCol); editableDataGrid1.TableStyles.Add(ts); //create some dummy data to test the grid List<something> things = new List<something>(); for (int i = 0; i < 100; i++) { things.Add(new something() { num1 = i, word = "word", button = "click me" }); } bindingSource1.DataSource = things; //editableDataGrid1.DataSource = things; }
public ControlTreeDataGrid(IApplicationController controller, FormDataEntryLogic dataEntryController, InputPanel sip) { this.Controller = controller; this.DataEntryController = dataEntryController; DataGridAdjuster.InitializeGrid(this); DataGridTableStyle tableStyle = DataEntryController.Unit.InitializeTreeColumns(this); this.AllowUserToAddRows = false;//don't allow down arrow to add tree this.SIP = sip; //this.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold); //initialize _BS_trees this._BS_trees = new System.Windows.Forms.BindingSource(); ((System.ComponentModel.ISupportInitialize)(this._BS_trees)).BeginInit(); this._BS_trees.DataSource = typeof(TreeVM); this._BS_trees.CurrentChanged += new EventHandler(_BS_trees_CurrentChanged); this.DataSource = this._BS_trees; ((System.ComponentModel.ISupportInitialize)(this._BS_trees)).EndInit(); _speciesColumn = tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn; _sgColumn = tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn; _stratumColumn = tableStyle.GridColumnStyles["Stratum"] as EditableComboBoxColumn; _treeNumberColumn = tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn; _initialsColoumn = tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn; _logsColumn = tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn; _kpiColumn = tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn; _errorsColumn = tableStyle.GridColumnStyles["Errors"] as DataGridTextBoxColumn; if (_logsColumn != null) { _logsColumn.Click += this.LogsClicked; } if (_initialsColoumn != null) { _initialsColoumn.DataSource = this.Controller.Settings.Cruisers.ToArray(); } }
public LayoutPlot(FormDataEntryLogic dataEntryController, Control parent, PlotStratum stratum, InputPanel sip) { Stratum = stratum; this.ViewLogicController = new LayoutPlotLogic(stratum, this, dataEntryController, dataEntryController.ViewController); InitializeComponent(); InitializePlotNavIcons(); //Setup Plot Nav Bar this._addPlotButton.Text = "+"; this._deletePlotButton.Text = "-"; this._plotInfoButton.Text = "i"; this._expandGridButton.ImageIndex = 0; this._expandGridButton.ButtonImageLayout = ImageLayout.Tile; this._nextPlotButton.ButtonImageLayout = ImageLayout.Zoom; this._gotoLastPlotButton.ButtonImageLayout = ImageLayout.Zoom; this._prevPlotButton.ButtonImageLayout = ImageLayout.Zoom; this._gotoFirstPlotButton.ButtonImageLayout = ImageLayout.Zoom; if (ViewController.PlatformType == PlatformType.WinCE) { this._expandGridButton.Font = new System.Drawing.Font("Arial", this._expandGridButton.Font.Size, this._expandGridButton.Font.Style); this._gotoFirstPlotButton.Font = new System.Drawing.Font("Arial", this._gotoFirstPlotButton.Font.Size, this._gotoFirstPlotButton.Font.Style); this._gotoLastPlotButton.Font = new System.Drawing.Font("Arial", this._gotoLastPlotButton.Font.Size, this._gotoLastPlotButton.Font.Style); this._nextPlotButton.Font = new System.Drawing.Font("Arial", this._nextPlotButton.Font.Size, this._nextPlotButton.Font.Style); this._prevPlotButton.Font = new System.Drawing.Font("Arial", this._prevPlotButton.Font.Size, this._prevPlotButton.Font.Style); } //Setup DataGrid DataGridAdjuster.InitializeGrid(this._dataGrid); _tableStyle = stratum.InitializeTreeColumns(_dataGrid); this._dataGrid.SIP = sip; this._dataGrid.CellValidating += new EditableDataGridCellValidatingEventHandler(_dataGrid_CellValidating); this._dataGrid.CellValueChanged += new EditableDataGridCellValueChangedEventHandler(this._dataGrid_CellValueChanged); //this._dataGrid.DataSource = typeof(FSCruiserV2.Logic.TreeVM);//_BS_Trees; this._dataGrid.Click += new EventHandler(_dataGrid_Click); this._dataGrid.ReadOnly = true; this._dataGrid.AllowUserToAddRows = false; _speciesColumn = _tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn; _sgColumn = _tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn; _treeNumberColumn = _tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn; _initialsColoumn = _tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn; _logsColumn = _tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn; _kpiColumn = _tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn; _errorsColumn = _tableStyle.GridColumnStyles["Error"] as DataGridTextBoxColumn; if (_logsColumn != null) { _logsColumn.Click += this.LogsClicked; } HandleCruisersChanged(); this.Dock = DockStyle.Fill; this.Parent = parent; InitializeTallyPanel(); this.ViewLogicController.UpdateCurrentPlot(); }