C#窗体如何实现datagridview中字体闪烁 Excuse me!各位,我想在datagridview中实现字体闪烁的效果,可是不知道应该怎么弄?所以请各路英雄能够拔刀相助,还望不吝赐教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用Timer改变要闪单元格的Style的ForeColor private bool bOrg = false; private void timer1_Tick(object sender, EventArgs e) { if (bOrg) this.dataGridView1[0, 0].Style.ForeColor = Color.Black; else this.dataGridView1[0, 0].Style.ForeColor = Color.Red; bOrg = !bOrg; } 晕S,Fore和Back好象没有相似的地方吧? http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/dbe44fd7-af5e-450e-9087-d5e67038110e/ 谢谢你的回答。请问:如果是要进行匹配字符后再判断是否闪烁又应该怎么办呢?比如:在datagridview中只要出现“警告”这个字符串时就会闪烁,而不是先设定某个单元格闪烁。 private bool bOrg = true; private void timer1_Tick(object sender, EventArgs e) { if (bOrg) { for (int i = 0; i < this.dataGridView1.ColumnCount; i++) { for (int j = 0; j < this.dataGridView1.Rows.Count; j++) { this.dataGridView1[i, j].Style.ForeColor = Color.Black;//原色 } } } else { for (int i = 0; i < this.dataGridView1.ColumnCount; i++) { for (int j = 0; j < this.dataGridView1.Rows.Count; j++) { if (this.dataGridView1[i, j].FormattedValue.ToString().IndexOf("警告") >= 0) this.dataGridView1[i, j].Style.ForeColor = Color.Red; } } } bOrg = !bOrg; }如果你的单元格数量非常大时,需要想办法只在当前可视的单元格中查找,方法应该不是太难,今天太晚了,你自己先找找吧 C# 中 如何实现 滚屏效果 BeginInvoke的用法??? 关于抽象类和接口的问题 无法嵌入互操作类型 (winFrom)求类似Microsoft Visual Studio .NET 2003 文档中的索引功能的解决思路 哈希表排序问题,如何按照加入哈希表顺序访问或取出哈希表的内容? c# 如何将摄像头捕获的数据流进行分析和鼠标的动态移动 调用web服务报错 关于绘图 如何将数据库由Sql企业版转移到个人版中? 文本提前和赋值的问题 如何让treeview 在窗体启动时,就选中第三项呢?
private bool bOrg = false;
private void timer1_Tick(object sender, EventArgs e)
{
if (bOrg)
this.dataGridView1[0, 0].Style.ForeColor = Color.Black;
else
this.dataGridView1[0, 0].Style.ForeColor = Color.Red;
bOrg = !bOrg;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (bOrg)
{
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
for (int j = 0; j < this.dataGridView1.Rows.Count; j++)
{
this.dataGridView1[i, j].Style.ForeColor = Color.Black;//原色
}
} }
else
{
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
for (int j = 0; j < this.dataGridView1.Rows.Count; j++)
{
if (this.dataGridView1[i, j].FormattedValue.ToString().IndexOf("警告") >= 0)
this.dataGridView1[i, j].Style.ForeColor = Color.Red;
}
}
}
bOrg = !bOrg;
}
如果你的单元格数量非常大时,需要想办法只在当前可视的单元格中查找,方法应该不是太难,今天太晚了,你自己先找找吧