Exemplo n.º 1
0
        void gvTables_RowPrePaint(object sender, System.Windows.Forms.DataGridViewRowPrePaintEventArgs e)
        {
            int row = e.RowIndex;

            if (row < 0)
            {
                return;
            }
            DataGridViewRow dr     = gvTables.Rows[row];
            string          exists = "未生成";
            DBTableInfo     info   = dr.DataBoundItem as DBTableInfo;

            if (info != null)
            {
                string fileName = DBEntityInfo.GetEntityRealFileName(info, _dbInfo, DesignerInfo);

                try
                {
                    if (File.Exists(fileName))
                    {
                        exists = "已生成";
                        dr.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
                catch { }
            }
            dr.Cells["ColExists"].Value = exists;
        }
Exemplo n.º 2
0
        private void dgvMktWatch_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            try
            {
                dgvMktWatch.PerformLayout();
                if (dgvMktWatch.InvokeRequired)
                {
                    dgvMktWatch.Invoke(new On_DataPaintdDelegate(dgvMktWatch_RowPrePaint), sender, e);
                    return;
                }
                if (Convert.ToString(dgvMktWatch.Rows[e.RowIndex].Cells["Indicator"].Value) == "+")
                {
                    //  DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
                    dgvMktWatch.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
                }
                else
                {

                    dgvMktWatch.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue;
                }
            }
            catch (Exception ex)
            {

            }
        }
Exemplo n.º 3
0
 private void DGV_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     try
     {
        this.DGV.PerformLayout();
        if (this.DGV.InvokeRequired)
         {
             this.DGV.Invoke(new On_DataPaintdDelegate(DGV_RowPrePaint), sender, e);
             return;
         }
        if (Convert.ToString(this.DGV.Rows[e.RowIndex].Cells["B/S"].Value) == "BUY")
         {
             //  DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
             this.DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue;
         }
         else
         {
             this.DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Order Book -  Funtion Name-  DGV2_RowPrePaint  " + ex.Message);
     }
 }
Exemplo n.º 4
0
        protected override void OnRowPrePaint(System.Windows.Forms.DataGridViewRowPrePaintEventArgs e)
        {
            DataGridViewPaintParts paintParts = (int)e.PaintParts - DataGridViewPaintParts.Focus;

            e.PaintParts = paintParts;
            base.OnRowPrePaint(e);
        }
Exemplo n.º 5
0
 //dgv隔行颜色
 private void dataGridView2_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     for (int i = 0; i < dataGridView2.Rows.Count; i++)
     {
         if (i % 2 == 1)
         {
             dataGridView2.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue;
         }
     }
 }
 private void dgvdata_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     int i = e.RowIndex;
     if (i == dgvdata.Rows.Count - 1 || dgvdata.Rows.Count == 1)
     {
         return;
     }
     DataGridViewRow row = dgvdata.Rows[i];
     shd = row.Cells[0].Value.ToString();
     textBox1.Text = shd;
 }
Exemplo n.º 7
0
 private void dgvData_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     int i = e.RowIndex;
     if (i == dgvData.Rows.Count - 1 || dgvData.Rows.Count == 1)
     {
         return;
     }
     DataGridViewRow row = dgvData.Rows[i];
     txtma.Text = row.Cells[0].Value.ToString();
     txtten.Text = row.Cells[1].Value.ToString();
     txtmota.Text = row.Cells[2].Value.ToString();
 }
        //收入、支出和结余显示不同的颜色
        private void dataGridView_billInfo_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            int rowCount = dataGridView_billInfo.Rows.Count;

            for (int i = 0; i < rowCount; i++)
            {
                dataGridView_billInfo.Rows[i].Cells["Col_AccountIn"].Style.ForeColor = Color.DarkBlue;
                dataGridView_billInfo.Rows[i].Cells["Col_AccountOut"].Style.ForeColor = Color.Chocolate;
                dataGridView_billInfo.Rows[i].Cells["Col_AccountBalance"].Style.BackColor = Color.Cornsilk;
                if (double.Parse(dataGridView_billInfo.Rows[i].Cells["Col_AccountBalance"].Value.ToString()) > 0)
                    dataGridView_billInfo.Rows[i].Cells["Col_AccountBalance"].Style.ForeColor = Color.Green;
                else dataGridView_billInfo.Rows[i].Cells["Col_AccountBalance"].Style.ForeColor = Color.Red;
            }
        }
        void dgvUserDetails_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            e.PaintCells(e.ClipBounds, DataGridViewPaintParts.All);

            e.PaintHeader(DataGridViewPaintParts.Background
                | DataGridViewPaintParts.Border
                | DataGridViewPaintParts.Focus
                | DataGridViewPaintParts.SelectionBackground
                | DataGridViewPaintParts.ContentForeground);
            using (SolidBrush b = new SolidBrush(dataGridView1.RowHeadersDefaultCellStyle.ForeColor))
            {
                e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 10, e.RowBounds.Location.Y + 4);
            }
            e.Handled = true;
        }
Exemplo n.º 10
0
        private void dgvArticulos_RowPrePaint(object sender, System.Windows.Forms.DataGridViewRowPrePaintEventArgs e)
        {
            var estado = (short)dgvArticulos.Rows[e.RowIndex].Cells[7].Value;

            if (estado == 0)    //Alta
            {
                dgvArticulos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Green;
            }
            if (estado == 1)    //Modificacion
            {
                dgvArticulos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Yellow;
            }
            if (estado == 2)    //Error
            {
                dgvArticulos.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
            }
        }
 private void dgvLogView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     string rowType = this.dgvLogView.Rows[e.RowIndex].Cells[0].Value.ToString();
     switch (rowType)
     {
         case "Information":
             this.dgvLogView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
             break;
         case "Error":
             this.dgvLogView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.IndianRed;
             break;
         case "Warning":
             this.dgvLogView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.CadetBlue;
             break;
         default:
             break;
     }
 }
Exemplo n.º 12
0
        private void dataGridViewTicketStatus_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var dataItem = dataGridViewTicketStatus.Rows[e.RowIndex].DataBoundItem as TrainLeftTicketStatus;
                if (dataItem.IsAttentionAvailable)
                {
                    DataGridViewRow dgr = dataGridViewTicketStatus.Rows[e.RowIndex];
                    dgr.DefaultCellStyle.ForeColor = Color.White;
                    dgr.DefaultCellStyle.BackColor = Color.PaleVioletRed;
                    if ( ( e.State & DataGridViewElementStates.Selected ) != DataGridViewElementStates.None )
                    {
                        dgr.DefaultCellStyle.SelectionForeColor = Color.White;
                        dgr.DefaultCellStyle.SelectionBackColor = Color.PaleVioletRed;
                    }
                }
                else
                {

                }
            }
        }
Exemplo n.º 13
0
 private void dgvData_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     int i = e.RowIndex;
     if (i == dgvData.Rows.Count - 1 || dgvData.Rows.Count == 1)
     {
         return;
     }
     DataGridViewRow row = dgvData.Rows[i];
     txttenk.Text = row.Cells[1].Value.ToString();
     txtsdt.Text = row.Cells[3].Value.ToString();
     txtdc.Text = row.Cells[4].Value.ToString();
     string gt = row.Cells[2].Value.ToString();
     if (gt == "Nam")
     {
         rdNam.Checked = true;
         rdNu.Checked = false;
     }
     else
     {
         rdNu.Checked = true;
         rdNam.Checked = false;
     }
 }
Exemplo n.º 14
0
		protected internal virtual void OnRowPrePaint (DataGridViewRowPrePaintEventArgs e)
		{
			DataGridViewRowPrePaintEventHandler eh = (DataGridViewRowPrePaintEventHandler)(Events [RowPrePaintEvent]);
			if (eh != null) eh (this, e);
		}
Exemplo n.º 15
0
        private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            // Do not automatically paint the focus rectangle.
            e.PaintParts &= ~DataGridViewPaintParts.Focus;

            // Determine whether the cell should be painted
            // with the custom selection background.
            if ((e.State & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected)
            {
                // Calculate the bounds of the row.
                Rectangle rowBounds = new Rectangle(
                    this.dataGridView1.RowHeadersWidth, e.RowBounds.Top,
                    this.dataGridView1.Columns.GetColumnsWidth(
                        DataGridViewElementStates.Visible) -
                    this.dataGridView1.HorizontalScrollingOffset + 1,
                    e.RowBounds.Height);

                // Paint the custom selection background.
                using (Brush backbrush =
                    new System.Drawing.Drawing2D.LinearGradientBrush(rowBounds,
                        this.dataGridView1.DefaultCellStyle.SelectionBackColor,
                        e.InheritedRowStyle.ForeColor,
                        System.Drawing.Drawing2D.LinearGradientMode.Horizontal))
                {
                    e.Graphics.FillRectangle(backbrush, rowBounds);
                }
            }
        }
Exemplo n.º 16
0
        private void pathsGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            DataGridViewRow row = pathsGridView.Rows[e.RowIndex];
            DBImportPath path = row.DataBoundItem as DBImportPath;

            string toolTipText = path.FullPath + "\n" + "Drive Type: " + path.GetDriveType().ToString();
            if (path.IsRemovable)
                toolTipText += " (Removable)\nOnline: " + path.IsAvailable;

            if (path.Replaced) {
                toolTipText += " (Replaced)";
                row.DefaultCellStyle.ForeColor = Color.DarkGray;
            }
            else {
                row.DefaultCellStyle.ForeColor = normalColor;
            }

            // add tooltip text
            row.Cells[0].ToolTipText = toolTipText;
        }
Exemplo n.º 17
0
        private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            DataGridViewRow dgr = dataGridView1.Rows[e.RowIndex];
            try
            {
                if (dgr.Cells["Type"].Value != null)
                {
                    if (dgr.Cells["Type"].Value.ToString() == Result.GetCLevel(Level.Execption))
                    {
                        dgr.DefaultCellStyle.ForeColor = Color.Red;
                    }
                    else if (dgr.Cells["Type"].Value.ToString() == Result.GetCLevel(Level.System))
                    {
                        dgr.DefaultCellStyle.ForeColor = Color.Blue;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
Exemplo n.º 18
0
 private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     if ((bool)dataGridView1[resultDataGridViewCheckBoxColumn.Index, e.RowIndex].Value)
     {
         dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGreen;
     }
     else
     {
         dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightPink;
     }
 }
Exemplo n.º 19
0
 private void gridview_RowPrePaint(System.Object sender, System.Windows.Forms.DataGridViewRowPrePaintEventArgs e)
 {
     // ' e.PaintParts &= DataGridViewPaintParts.Focus
     e.PaintParts &= ~DataGridViewPaintParts.Focus;
 }
Exemplo n.º 20
0
 private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     e.PaintParts &= ~DataGridViewPaintParts.Focus;
     e.PaintParts &= ~DataGridViewPaintParts.SelectionBackground;
 }
Exemplo n.º 21
0
 private void dgvPlayers_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     e.PaintParts &= ~DataGridViewPaintParts.Focus;
 }
Exemplo n.º 22
0
 private void dgvBonusFactStaff_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     //dgvBonusFactStaff.Rows[e.RowIndex].DataBoundItem
     if ((dgvBonusFactStaff.Rows[e.RowIndex].DataBoundItem as Bonus).HasHistoryChanges)
     {
         dgvBonusFactStaff.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Bisque;
         dgvBonusFactStaff.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.DarkOrange;
     }
     else
     {
         dgvBonusFactStaff.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// PrePaint事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgv_Msg_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     e.PaintParts = e.PaintParts ^ DataGridViewPaintParts.Focus;
 }
Exemplo n.º 24
0
 /// <summary>
 /// before the first row is painted we register the CellValueNeeded-handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void dgvCommandersLog_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     try
     {
         if(!m_CellValueNeededIsRegistered)
         { 
             dgvCommandersLog.CellValueNeeded          += new DataGridViewCellValueEventHandler(dgvCommandersLog_CellValueNeeded);
             dgvCommandersLog.CellValuePushed          += new DataGridViewCellValueEventHandler(dgvCommandersLog_CellValuePushed);
             m_CellValueNeededIsRegistered = true;
         }
     }
     catch (Exception ex)
     {
         CErr.processError(ex, "Error in dgvCommandersLog_RowPrePaint");
     }
 }
Exemplo n.º 25
0
 protected override void OnRowPrePaint(DataGridViewRowPrePaintEventArgs e)
 {
     e.PaintParts &= ~DataGridViewPaintParts.Focus;
     base.OnRowPrePaint(e);
 }
        //将dataGridView里的支出显示红色
        private void dataGridView_out_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            int rowCount = dataGridView_out.Rows.Count;

            for (int i = 0; i < rowCount; i++)
            {
                dataGridView_out.Rows[i].Cells["classAccInOut"].Style.ForeColor = Color.Red;
            }
        }
Exemplo n.º 27
0
 private void BlameGrid_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
 }
Exemplo n.º 28
0
 private void dgvquanlyhangve_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     for (int i = 0; i < dgvquanlyhangve.RowCount; i++)
     {
         dgvquanlyhangve[0, i].Value = i + 1;
     }
 }
Exemplo n.º 29
0
        void data_grid_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            Color color_row = Color.White;

            switch ((log_manager.log_type_t)(Convert.ToByte(this.data_grid.Rows[e.RowIndex].Cells["type"].Value)))
            { 
                case log_manager.log_type_t.ERROR:
                    color_row = Color.OrangeRed;
                    break;

                case log_manager.log_type_t.WARNING:
                    color_row = Color.Yellow;
                    break;

                case log_manager.log_type_t.MESSAGE:
                    color_row = Color.White;
                    break;

                default:
                    break;
            }

            this.data_grid.Rows[e.RowIndex].DefaultCellStyle.BackColor = color_row;
        }
Exemplo n.º 30
0
 private void dataGridMov_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     if (dataGridMov.Rows[e.RowIndex].Cells["tipo"].Value.ToString() == "uscita")
     {
         dataGridMov.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
     }
     if (dataGridMov.Rows[e.RowIndex].Cells["tipo"].Value.ToString() == "entrata")
     {
         dataGridMov.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Green;
     }
 }
Exemplo n.º 31
0
 private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     if (dataGridView1.Rows.Count <= e.RowIndex) return;
     if (e.RowIndex < 0) return;
     if (dataGridView1.Rows[e.RowIndex].Cells["status"].Value == null) return;
     if (dataGridView1.Rows[e.RowIndex].Cells["status"].Value.ToString() == "1")
     {
         DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
         row.DefaultCellStyle.BackColor = Color.Lime;
         //if (row.Selected)
         //{
         //    row.DefaultCellStyle.SelectionBackColor = Color.Yellow;
         //    row.DefaultCellStyle.SelectionForeColor = Color.Red;
         //}
     }
     else if (dataGridView1.Rows[e.RowIndex].Cells["status"].Value.ToString() == "2")
     {
         DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
         row.DefaultCellStyle.BackColor = Color.LightYellow;
     }
     else if (dataGridView1.Rows[e.RowIndex].Cells["status"].Value.ToString() == "3")
     {
         DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
         row.DefaultCellStyle.BackColor = Color.Red;
     }
 }
Exemplo n.º 32
0
        private void DGV_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            try{
            if (DGV.InvokeRequired)
            {
                DGV.Invoke(new On_DataPaintdDelegate(DGV_RowPrePaint), sender, e);
                return;
            }

            if (DGV.Rows[e.RowIndex].Cells["Buy_SellIndicator"].Value.ToString() == "BUY")
            {
                //  DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
                DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue;
            }
            else
            {
                //  DGV.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Blue;
                DGV.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
            }
             }
            catch (Exception ex)
            {

                MessageBox.Show("Trade Book -  Funtion Name-  toolStripButton1_Click  " + ex.Message);
            }
        }
 private void dataGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
 {
     this.dataGridView.Rows[e.RowIndex].Cells[0].Value = (e.RowIndex + 1).ToString();
 }
Exemplo n.º 34
0
 // ** overrides
 // show row numbers in row headers
 protected override void OnRowPrePaint(DataGridViewRowPrePaintEventArgs e)
 {
     var cell = this.Rows[e.RowIndex].HeaderCell;
     var label = (e.RowIndex + 1).ToString();
     if (!object.Equals(cell.Value, label))
     {
         cell.Value = label;
     }
     base.OnRowPrePaint(e);
 }