//uses the x,y position of mouse click to find what item was clicked on //and determins if the item click resulted in the item being removed //or added to the list of selected items //private void CuttingUnitListBox_MouseClick(object sender, MouseEventArgs e) //{ // var index = CuttingUnitListBox.IndexFromPoint(e.X, e.Y); // //check for error value // if (index < 0) // { // //filter out // return; // } // var stratum = StrataBindingSource.Current as StratumDO; // var cuttingUnit = CuttingUnitBindingSource[index] as CuttingUnitDO; // if (stratum == null || cuttingUnit == null) // { // return; // } // if (CuttingUnitListBox.SelectedIndices.Contains(index)) // { // stratum.CuttingUnits.Add(cuttingUnit); // } // else // { // stratum.CuttingUnits.Remove(cuttingUnit); // } //} #endregion Click Events protected override void OnLoad(EventArgs e) { base.OnLoad(e); InitializeBindings(); if (Presentor.Strata.Count == 0) { StrataBindingSource.AddNew(); } this.CodeTextBox.Focus(); }
public bool HandleKeypress(System.Windows.Forms.Keys key) { if (key == System.Windows.Forms.Keys.F1) { StrataBindingSource.AddNew(); this.CodeTextBox.Focus(); return(true); } return(false); }