简体   繁体   中英

DataGridView Cell Focus

I'm making an application with windows forms and a DataGridView but have a little problem here.

I've tried a couple of things but it seems that I can't remove this focus around the Selected Cell (Dotted line).

在此处输入图像描述

And I'd like to make it look like this when the row is clicked:

在此处输入图像描述

Just simply remove the dotted line all together from DGV. Is it possible?

Row selection is set to FullRowSelect, TabStop is False, MultiSelect is False. I've also tried with e.PaintParts in CellPainting to no avail. Any hints?

The only thing that worked for me was to create a custom control that inherits from DataGridView and then override the ShowFocusCues like this:

protected override bool ShowFocusCues
    {
        get
        {
            return false;
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM