现在想实现如下效果:当鼠标移动到cell的内容(一般就是text文本啦)上的时候,把字体放大一号,或者把鼠标指针放大一号
要求:1.鼠标在cell空白地方的时候,不发生任何改变
      2.不要用C#的LinkCell,要用自定义的cell类(继承于donet的cell类)来实现ps:不要说把整个girdview的字体全部放大一号。-_-!!!

解决方案 »

  1.   


            private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
            {
                if (dataGridView1.Rows.Count > 0 && e.RowIndex!=-1)
                {
                    if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                    {
                        if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != "")
                        {
                            dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Font = new Font("宋体", 15);
                        }
                    }
                }
            }        private void dataGridView1_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
            {
                if (dataGridView1.Rows.Count > 0 && e.RowIndex != -1)
                {
                    if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                    {
                        if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != "")
                        {
                            dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Font = new Font("宋体", 12);
                        }
                    }
                }
            }
    自己现做的 ,测试成功
      

  2.   


    不满足要求1我的意思是说:假如这个cell宽为200,但是里面只有一个数字“1”,那么这个cell里面肯定有很多空白的地方,要求鼠标只有在数字“1”上面的时候才发生改变,在空白的地方不变。而不是空白的没有值的cell