Пример #1
0
        private void OnGridDataChangeded(object sender, GridDataChangedHandlerArgs gridDataChangedHandlerArgs)
        {
            var dgv = (DataGridView) sender;
            if (dgv == null || dgv.Rows.Count <= 0) return;

            var objRHStyle = new DataGridViewCellStyle();
            objRHStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.RowHeadersDefaultCellStyle = objRHStyle;
            dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;

            for (int i = 0; i < dgv.RowCount; i++)
            {
                DataGridViewRow aitem = dgv.Rows[i];
                object obj = aitem.DataBoundItem;
                var objz = (WmiServiceObj) obj;

                //aitem.HeaderCell.Value = objz.OrderNo.ToString();

                if (_arSyses.Contains(objz.ExeName))
                {
                    for (int j = 0; j < dgv.ColumnCount; j++)
                    {
                        DataGridViewCellStyle clStyle = aitem.Cells[j].Style;
                        clStyle.ForeColor = Color.Red;
                    }
                }

                if (objz.StartMode.ToLower() == "disabled")
                {
                    for (int j = 0; j < dgv.ColumnCount; j++)
                    {
                        DataGridViewCellStyle clStyle = aitem.Cells[j].Style;
                        clStyle.BackColor = Color.GhostWhite;
                    }
                }

                if (objz.State.ToLower() == "stopped")
                {
                    for (int j = 0; j < dgv.ColumnCount; j++)
                    {
                        DataGridViewCellStyle clStyle = aitem.Cells[j].Style;
                        clStyle.BackColor = Color.DarkGray;
                        clStyle.ForeColor = Color.Blue;
                    }
                }
            }
        }
Пример #2
0
 protected virtual void OnGridDataChangeded(GridDataChangedHandlerArgs e)
 {
     GridDataChangeded(this, e); //Raise the event
 }