• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DataGridViewRowPrePaintEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DataGridViewRowPrePaintEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewRowPrePaintEventArgs类的具体用法?C# DataGridViewRowPrePaintEventArgs怎么用?C# DataGridViewRowPrePaintEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataGridViewRowPrePaintEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewRowPrePaintEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: dgvBonusFactStaff_RowPrePaint

 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;
     }
 }
开发者ID:UGTU,项目名称:UGTUKadrProject,代码行数:13,代码来源:BonusFrame.cs


示例17: OnRowPrePaint

 protected override void OnRowPrePaint(DataGridViewRowPrePaintEventArgs e)
 {
     e.PaintParts &= ~DataGridViewPaintParts.Focus;
     base.OnRowPrePaint(e);
 }
开发者ID:omega227,项目名称:DeanCC,代码行数:5,代码来源:BindingDataGridView.cs


示例18: OnRowPrePaint

 // ** 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);
 }
开发者ID:rfkhan708,项目名称:san,代码行数:12,代码来源:DataGridCalc.cs


示例19: data_grid_RowPrePaint

        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;
        }
开发者ID:rdengineering,项目名称:Utils.Log,代码行数:24,代码来源:LogTable.cs


示例20: dataGridView1_RowPrePaint

 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;
     }
 }
开发者ID:Karolass,项目名称:WebCrawler-SFACG,代码行数:26,代码来源:Form_SFACG.cs



注:本文中的System.Windows.Forms.DataGridViewRowPrePaintEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewRowsAddedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridViewRowPostPaintEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap