当前位置: 首页>>代码示例>>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;未经允许,请勿转载。