本文整理汇总了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)
{
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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
{
}
}
}
示例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;
}
}
示例11: OnRowPrePaint
protected internal virtual void OnRowPrePaint (DataGridViewRowPrePaintEventArgs e)
{
DataGridViewRowPrePaintEventHandler eh = (DataGridViewRowPrePaintEventHandler)(Events [RowPrePaintEvent]);
if (eh != null) eh (this, e);
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
}