怎样在点击datagridview的单元格后,这个单元格周围不出现虚线框?

解决方案 »

  1.   


    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;
    namespace WindowsApplication13
    {
        class Class1:DataGridView 
        {        public Class1()
            {
                this.RowPrePaint += new DataGridViewRowPrePaintEventHandler(Class1_RowPrePaint);
            }        void Class1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
            {
                e.PaintParts = DataGridViewPaintParts.All ^ DataGridViewPaintParts.Focus;         }    }
      

  2.   

    这个问题有了新的解法,看起来很简单,就是先把控件Enabled设为false,接着再设为true就OK了,亲测~