private void RuleGrid_DoubleClick(object sender, EventArgs e) { CurrencyManager cm = (CurrencyManager)this.BindingContext[this.RuleGrid.DataSource]; if (cm.Count == 0) { return; } Object obj = cm.Current; if (obj == null || !(obj is VcActEtyRelation)) { return; } VcActEtyRelation actEtyRln = obj as VcActEtyRelation; if (actEtyRln.Relation == eActEtyRelation.rule) { RuleSetupFm.SetEntityRule(actEtyRln.Entity); } else if (actEtyRln.Relation == eActEtyRelation.clash) { this.OpenScheduleFm((actEtyRln.Entity as EnClsLesson).Squad); } else //教师 { this.OpenScheduleFm(actEtyRln.Entity); } }
private void RuleGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex != 2) { return; } VcActEtyRelation rln = RuleGrid.Rows[e.RowIndex].DataBoundItem as VcActEtyRelation; e.CellStyle.BackColor = ViewStyle.RuleToColor(rln.Rule); }