當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.DataGridViewRowPrePaintEventArgs類代碼示例

本文整理匯總了C#中System.Windows.Forms.DataGridViewRowPrePaintEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# DataGridViewRowPrePaintEventArgs類的具體用法?C# DataGridViewRowPrePaintEventArgs怎麽用?C# DataGridViewRowPrePaintEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataGridViewRowPrePaintEventArgs類屬於System.Windows.Forms命名空間,在下文中一共展示了DataGridViewRowPrePaintEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: dgvMktWatch_RowPrePaint

        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)
            {

            }
        }
開發者ID:rfkhan708,項目名稱:san,代碼行數:26,代碼來源:frmSpot.cs

示例2: DGV_RowPrePaint

 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);
     }
 }
開發者ID:spsinghdocument1,項目名稱:C-,代碼行數:25,代碼來源:Trade_Tracker.cs

示例3: dataGridView2_RowPrePaint

 //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;
         }
     }
 }
開發者ID:hkiaipc,項目名稱:guye,代碼行數:11,代碼來源:xg_main.cs

示例4: dgvdata_RowPrePaint

 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;
 }
開發者ID:buituankiet,項目名稱:BanHang_Kietbntps,代碼行數:11,代碼來源:DánhachhoaDon.cs

示例5: dgvData_RowPrePaint

 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();
 }
開發者ID:buituankiet,項目名稱:BanHang_Kietbntps,代碼行數:12,代碼來源:FormLoaiSP.cs

示例6: dataGridView_billInfo_RowPrePaint

        //收入、支出和結餘顯示不同的顏色
        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;
            }
        }
開發者ID:xiaohe0-0,項目名稱:CSharp_AccountingSystem,代碼行數:15,代碼來源:Account_BillCheck.cs

示例7: dgvUserDetails_RowPrePaint

        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;
        }
開發者ID:RiazMahmud,項目名稱:ATK-Computer-LTD,代碼行數:15,代碼來源:UnpaidInvoiceForm.cs

示例8: dgvLogView_RowPrePaint

 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;
     }
 }
開發者ID:RyanTBerry,項目名稱:WindowsAzureDeploymentTracker,代碼行數:18,代碼來源:AppLogViewer.cs

示例9: dataGridViewTicketStatus_RowPrePaint

        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
                {

                }
            }
        }
開發者ID:seamusic,項目名稱:TicketHelper,代碼行數:22,代碼來源:MyAttentionTicketsForm.cs

示例10: dgvData_RowPrePaint

 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;
     }
 }
開發者ID:buituankiet,項目名稱:BanHang_Kietbntps,代碼行數:23,代碼來源:FormKhachhang.cs

示例11: OnRowPrePaint

		protected internal virtual void OnRowPrePaint (DataGridViewRowPrePaintEventArgs e)
		{
			DataGridViewRowPrePaintEventHandler eh = (DataGridViewRowPrePaintEventHandler)(Events [RowPrePaintEvent]);
			if (eh != null) eh (this, e);
		}
開發者ID:vnan122,項目名稱:mono,代碼行數:5,代碼來源:DataGridView.cs

示例12: pathsGridView_RowPrePaint

        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;
        }
開發者ID:damienhaynes,項目名稱:moving-pictures,代碼行數:20,代碼來源:ImportPathsPane.cs

示例13: dataGridView1_RowPrePaint

        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);
                }
            }
        }
開發者ID:GininDev,項目名稱:ServicesInforCollector,代碼行數:28,代碼來源:FrmMain.cs

示例14: dataGridView1_RowPrePaint

 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;
     }
 }
開發者ID:natashalysakova,項目名稱:DiagnostikaPlus,代碼行數:11,代碼來源:MainForm.cs

示例15: dataGridView1_RowPrePaint

        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);
            }

        }
開發者ID:iraychen,項目名稱:DataDicPub,代碼行數:23,代碼來源:DataDicForm.cs


注:本文中的System.Windows.Forms.DataGridViewRowPrePaintEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。