Reverse Sorting ListView with Right-Click

C

Claes Bergefall

You'll have to add your own code for that. It's pretty easy with some
inheritance and P/Invoke stuff. Something like this should work (inherit
ListView):

private const int WM_NOTIFY = 0x4E;
private const int NM_FIRST = 0;
private const int NM_RCLICK = NM_FIRST - 5;

[StructLayout(LayoutKind.Sequential)]
private struct NMHDR
{
public IntPtr hwndFrom;
public int idFrom;
public int code;
}

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_NOTIFY)
{
NMHDR nm = (NMHDR) m.GetLParam(typeof(NMHDR));
if (nm.code == NM_RCLICK)
{
// TODO: Handle right click
}
}
base.WndProc(ref m);
}

/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top