当前位置:编程学习 > C#/ASP.NET >>

求助:datagridview做出闪烁效果

比如,当前这一秒每行的背景色是红色;
下一秒变成白色,如此循环,谢谢! --------------------编程问答-------------------- 有点难度
--------------------编程问答-------------------- 肯定可以实现。 --------------------编程问答-------------------- 用timer刷呗 --------------------编程问答-------------------- cs? --------------------编程问答--------------------
public Form1()
        {
            InitializeComponent();

            dataGridView1.BackgroundColor = Color.White;
        }

private void timer1_Tick(object sender, EventArgs e)
        {
            if (dataGridView1.BackgroundColor == Color.White)
                dataGridView1.BackgroundColor = Color.Green;
            else
                dataGridView1.BackgroundColor = Color.White;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }
--------------------编程问答-------------------- 貌似这个更符合你得要求
private void timer1_Tick(object sender, EventArgs e)
        {
            if (dataGridView1.RowsDefaultCellStyle.BackColor == Color.White)
                dataGridView1.RowsDefaultCellStyle.BackColor = Color.Red;
            else
                dataGridView1.RowsDefaultCellStyle.BackColor = Color.White;
        }
--------------------编程问答-------------------- private void timer1_Tick(object sender, EventArgs e)
        {
this.dataGridView1.RowsDefaultCellStyle.BackColor =(dataGridView1.RowsDefaultCellStyle.BackColor == Color.Red?Color.White:
 Color.Red;
this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor =Color.Red;
}
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,