private void DataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex >= 0) { { GreigeRoll roll = this.sewinQueue.Rolls[e.RowIndex]; if (e.ColumnIndex == this.colMeasuredLength.Index) { if (e.RowIndex < this.logic.CurrentRollIndex) { (e.CellStyle.ForeColor, e.CellStyle.BackColor) = roll.RollLength == 0 ? new CellColor { ForeColor = this.dataGridView1.DefaultCellStyle.ForeColor, BackColor = this.dataGridView1.DefaultCellStyle.BackColor } : CellColor.GetFeetColor(roll.RollLength, (long)e.Value, this.serviceSettings); } } else if (roll.IsComplete) { (e.CellStyle.ForeColor, e.CellStyle.BackColor) = CellColor.IsCompletedColor; } } } }
public void SetCutSkewColor(DataGridViewCellFormattingEventArgs args, IServiceSettings settings) { GreigeRoll roll = this.carpetProcessor.PatternRepeatLogic.CurrentRoll; (args.CellStyle.ForeColor, args.CellStyle.BackColor) = CellColor.GetSkewColor(roll.BackingCode, (double)args.Value, this.serviceSettings); }
public void SetSkewColor(DataGridViewCellFormattingEventArgs args, IServiceSettings settings) { GreigeRoll roll = (GreigeRoll)this.grdGreigeRoll.Rows[args.RowIndex].DataBoundItem; (args.CellStyle.ForeColor, args.CellStyle.BackColor) = CellColor.GetSkewColor(roll.BackingCode, (double)args.Value, this.serviceSettings); }
public void SetCompletedColor(DataGridViewCellFormattingEventArgs args) { GreigeRoll roll = (GreigeRoll)this.grdGreigeRoll.Rows[args.RowIndex].DataBoundItem; (args.CellStyle.ForeColor, args.CellStyle.BackColor) = roll.IsComplete ? CellColor.GetIsCompletedColorColor() : this.defaultCellColor; }
public void SetFeetColor(DataGridViewCellFormattingEventArgs args, IServiceSettings settings) { GreigeRoll roll = (GreigeRoll)this.grdGreigeRoll.Rows[args.RowIndex].DataBoundItem; long measuredLength = (long)args.Value; (args.CellStyle.ForeColor, args.CellStyle.BackColor) = roll.RollLength == 0 ? this.defaultCellColor : CellColor.GetFeetColor(roll.RollLength, (long)args.Value, this.serviceSettings); }
public MainForm(ICarpetProcessor carpetProcessor, ICutRollList cutRollList, IInspectionAreaList inspectionAreaList, IMahloIpcClient mahloClient, IServiceSettings serviceSettings) { this.InitializeComponent(); this.carpetProcessor = carpetProcessor; this.cutRollList = cutRollList; this.inspectionAreaList = inspectionAreaList; this.mahloClient = mahloClient; this.serviceSettings = serviceSettings; this.statusBar1.StatusBarInfo = (IStatusBarInfo)this.carpetProcessor.PatternRepeatLogic; this.defaultCellColor = new CellColor { ForeColor = this.grdGreigeRoll.DefaultCellStyle.ForeColor, BackColor = this.grdGreigeRoll.DefaultCellStyle.BackColor }; this.disposables.Add( Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>( h => ((INotifyPropertyChanged)this.carpetProcessor.MahloLogic).PropertyChanged += h, h => ((INotifyPropertyChanged)this.carpetProcessor.MahloLogic).PropertyChanged -= h) .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.MahloLogic.CurrentRoll)) .Subscribe(args => { this.mahloRollSrc.DataSource = this.carpetProcessor.MahloLogic.CurrentRoll; this.DoAutoScroll(); this.grdGreigeRoll.Invalidate(); })); this.disposables.Add( Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>( h => ((INotifyPropertyChanged)this.carpetProcessor.BowAndSkewLogic).PropertyChanged += h, h => ((INotifyPropertyChanged)this.carpetProcessor.BowAndSkewLogic).PropertyChanged -= h) .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.BowAndSkewLogic.CurrentRoll)) .Subscribe(args => { this.bowAndSkewRollSrc.DataSource = this.carpetProcessor.BowAndSkewLogic.CurrentRoll; this.DoAutoScroll(); this.grdGreigeRoll.Invalidate(); })); this.disposables.Add( Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>( h => ((INotifyPropertyChanged)this.carpetProcessor.PatternRepeatLogic).PropertyChanged += h, h => ((INotifyPropertyChanged)this.carpetProcessor.PatternRepeatLogic).PropertyChanged -= h) .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.PatternRepeatLogic.CurrentRoll)) .Subscribe(args => { this.patternRepeatRollSrc.DataSource = this.carpetProcessor.PatternRepeatLogic.CurrentRoll; this.DoAutoScroll(); this.grdGreigeRoll.Invalidate(); })); // Make column heading alignment match column data alignment foreach (DataGridViewColumn column in this.grdGreigeRoll.Columns) { column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment; } foreach (DataGridViewColumn column in this.grdCutRoll.Columns) { column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment; } foreach (DataGridViewColumn column in this.grdInspectionArea.Columns) { column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment; } this.colMalFeet.Tag = this.colBasFeet.Tag = this.colPrsFeet.Tag = new CellFormattingAction(this.SetFeetColor); this.colBow.Tag = new CellFormattingAction(this.SetBowColor); this.colSkew.Tag = new CellFormattingAction(this.SetSkewColor); this.colElongation.Tag = new CellFormattingAction(this.SetElongationColor); this.colCutBow.Tag = new CellFormattingAction(this.SetCutBowColor); this.colCutSkew.Tag = new CellFormattingAction(this.SetCutSkewColor); this.colCutElongation.Tag = new CellFormattingAction(this.SetCutEPEColor); }