void ht_HLB_Set(Dictionary<int, int> dic) { //匿名函数 Action<int> fun = (int jhShare_Iid) => { try { switch (dic[jhShare_Iid]) { case 0: s.Color = GradientButtons.ColorEnum.red; break; case 1: s.Color = GradientButtons.ColorEnum.blue; break; case 2: s.Color = GradientButtons.ColorEnum.white; break; } } catch { }; }; //设置计划员按钮颜色 this.li_btnJHY.ForEach(s => { fun((s.Value as rgjh_jhy_Models).jhShare_Iid); }); this.li_btnSC.ForEach(s => { fun((s.Value as rgjh_jhy_Models).jhShare_Iid); }); }