示例#1
0
 private void CheckCellColor(object sender, DataGridEnableEventArgs e)
 {
     if (dgClear.CurrentCell.RowNumber == e.Row && curRow != -1)
     {
         e.MeetsCriteria = true;
         e.BackColor     = Color.Aquamarine;
         e.ForeColor     = SystemColors.WindowText;
     }
     else
     {
         string status = dtClear.Rows[e.Row]["STATUS"].ToString();
         if (status == "True")
         {
             e.MeetsCriteria = true;
             e.BackColor     = SystemColors.Window;
             e.ForeColor     = SystemColors.WindowText;
         }
         else
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Gainsboro;
             e.ForeColor     = SystemColors.WindowText;
         }
     }
 }
示例#2
0
 private void CheckCellColor(object sender, DataGridEnableEventArgs e)
 {
     if (curPoint.row == e.Row && curPoint.col == e.Column && curPoint.row != -1)
     {
         e.MeetsCriteria = true;
         e.BackColor     = Color.Orange;
         e.ForeColor     = SystemColors.WindowText;
     }
     else
     {
         string    clh = dtFrame.Rows[e.Row][e.Column].ToString();
         CoilPoint p   = new CoilPoint(Global.curFrame.KJH, e.Row, e.Column);
         if (Global.coils.ContainsKey(p))        //有占位信息
         {
             if (Global.coils[p].scantime != "") //材料经过比对
             {
                 if (Global.coils[p].qa != "")
                 {
                     e.MeetsCriteria = true;
                     e.BackColor     = Color.BlueViolet;
                     e.ForeColor     = SystemColors.WindowText;
                 }
                 else
                 {
                     if (Global.coils[p].scanflag == 1)//材料比对成功
                     {
                         e.MeetsCriteria = true;
                         e.BackColor     = Color.PaleGreen;
                         e.ForeColor     = SystemColors.WindowText;
                     }
                     else if (Global.coils[p].scanflag == 0)//材料比对失败
                     {
                         e.MeetsCriteria = true;
                         e.BackColor     = Color.LightSalmon;
                         e.ForeColor     = SystemColors.WindowText;
                     }
                 }
             }
             else
             {
                 e.MeetsCriteria = true;
                 e.BackColor     = Color.SkyBlue;
                 e.ForeColor     = SystemColors.WindowText;
             }
         }
         else
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Cornsilk;
             if (e.Column == 0)
             {
                 e.ForeColor = Color.Red;
             }
             else
             {
                 e.ForeColor = SystemColors.WindowText;
             }
         }
     }
 }
示例#3
0
文件: common.cs 项目: loveishere/A-B-
        //public ColumnStyle(int column)
        //{
        //_col = column;
        //}

        protected override void Paint(Graphics g, Rectangle Bounds, CurrencyManager Source, int RowNum, Brush BackBrush, Brush ForeBrush, bool AlignToRight)
        {
            //can remove this if you don't want to vary the formatting on disabled cells
            bool enabled = true;

            //check if our event handler is not null for this cell and then signal the event
            //the returning result in 'e' will contain a true or false boolean value
            //the event can be 'receieved' anywhere in our program and the logic can be anything
            // we choose.  The method called from the event simply has to match our 'CheckCellEventHandler'
            //delegate.
            //if (CheckCellEven != null)
            //{
            //    DataGridEnableEventArgs e = new DataGridEnableEventArgs(RowNum, _col, enabled);
            //    CheckCellEven(this, e);
            //    if (e.MeetsCriteria)
            //        BackBrush = new SolidBrush(Color.Orange);
            //}

            //repeat again for our second event handler
            if (CheckCellContains != null)
            {
                DataGridEnableEventArgs e = new DataGridEnableEventArgs(RowNum, _col, enabled);
                CheckCellContains(this, e);
                if (e.MeetsCriteria)
                {
                    BackBrush = new SolidBrush(e.BackColor);
                    ForeBrush = new SolidBrush(e.ForeColor);
                }
            }

            base.Paint(g, Bounds, Source, RowNum, BackBrush, ForeBrush, AlignToRight);

            //out third event handler , we are going to use this draw a rectangle around our
            //cell so we call it after we have called the base class paint method
            //if (CheckCellEquals != null)
            //{
            //    DataGridEnableEventArgs e = new DataGridEnableEventArgs(RowNum, _col, enabled);
            //    CheckCellEquals(this, e);
            //    if (e.MeetsCriteria)
            //        g.DrawRectangle(new Pen(Color.Red, 2), Bounds.X + 1, Bounds.Y + 1, Bounds.Width - 2, Bounds.Height - 2);
            //}
        }
示例#4
0
 public void CheckCellColor(object sender, DataGridEnableEventArgs e)
 {
     if (dgSxChange.CurrentCell.RowNumber == e.Row && curRow != -1)
     {
         e.MeetsCriteria = false;
     }
     else
     {
         if (dtJhzy.Rows[e.Row]["KJH"].ToString() == Global.curFrame.CH)
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Blue;
             e.ForeColor     = SystemColors.WindowText;
         }
         else
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Cornsilk;
             e.ForeColor     = SystemColors.WindowText;
         }
     }
 }
示例#5
0
文件: frmWtd.cs 项目: loveishere/A-B-
 public void CheckCellColor(object sender, DataGridEnableEventArgs e)
 {
     if (dgWtd.CurrentCell.RowNumber == e.Row && curRow != -1)
     {
         e.MeetsCriteria = false;
     }
     else
     {
         bool bval = Convert.ToBoolean(dtWtd.Rows[e.Row]["CRFLAG"]);
         if (bval)
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Cyan;
             e.ForeColor     = SystemColors.WindowText;
         }
         else
         {
             e.MeetsCriteria = true;
             e.BackColor     = SystemColors.Window;
             e.ForeColor     = SystemColors.WindowText;
         }
     }
 }
示例#6
0
 public void CheckCellColor(object sender, DataGridEnableEventArgs e)
 {
     if (dgWtdCl.CurrentCell.RowNumber == e.Row && curRow != -1)
     {
         e.MeetsCriteria = false;
     }
     else
     {
         string wcflag = dtCl.Rows[e.Row]["WCFlag"].ToString();
         string qa     = dtCl.Rows[e.Row]["QA"].ToString();
         if (wcflag == "" || wcflag == "0")
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Cyan;
             e.ForeColor     = SystemColors.WindowText;
         }
         else if (wcflag == "1")
         {
             e.MeetsCriteria = true;
             if (qa != "" && qa != "0")
             {
                 e.BackColor = Color.BlueViolet;
             }
             else
             {
                 e.BackColor = Color.Salmon;
             }
             e.ForeColor = SystemColors.WindowText;
         }
         else
         {
             e.MeetsCriteria = true;
             e.BackColor     = Color.Silver;
             e.ForeColor     = SystemColors.WindowText;
         }
     }
 }