Based on the comment in the link provided by AVIDeveloper.
While the ShowFocusCues itself didn't work, the WM_CHANGEUISTATE
listed on that MSDN page led me to the right answer. By sending a
WM_CHANGEUISTATE message with UISF_HIDEFOCUS I was able to get rid of
the focus rectangle. – Telanor Apr 22 '10 at 17:11
I tried to find some information about this messages and eventualy saw this post: http://cboard.cprogramming.com/csharp-programming/128345-listview-remove-focuscues.html#post958690
So, we need to send the WM_CHANGEUISTATE message to the ListView in the constructor
SendMessage(Handle, 0x127, 0x10001, 0);
And we are only going to override the OnSelectedIndexChanged and OnEnter events.
protected override void OnSelectedIndexChanged(EventArgs e)
{
base.OnSelectedIndexChanged(e);
SendMessage(Handle, 0x127, 0x10001, 0);
}
protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
SendMessage(Handle, 0x127, 0x10001, 0);
}
Without overriding the OnEnter event, the same black dotted selection rectangle will appear when the ListView gets the focus.
I tried to explain the best I could since I'm not a fluent English speaker and I'm going to wait if someone has a better answer before accepting mine.