📄 listviewsubclass.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
using OpenNETCF.Windows.Forms;
namespace ListViewToolTip
{
public class ListViewSubclass : NativeWindow
{
public event MouseEventHandler MouseDown;
private const int WM_LBUTTONDOWN = 0x0201;
private ListView listView;
public ListViewSubclass(ListView listView)
{
this.listView = listView;
this.AssignHandle(listView.Handle);
}
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_LBUTTONDOWN)
{
int y = HiWord((int)m.LParam);
int x = LoWord((int)m.LParam);
MouseEventArgs args = new MouseEventArgs(0, 1, x, y, 0);
if (MouseDown != null)
{
MouseDown(listView, args);
}
}
base.WndProc(ref m);
}
private static int HiWord(int number)
{
if ((number & 0x80000000) == 0x80000000)
return (number >> 16);
else
return (number >> 16) & 0xffff;
}
private static int LoWord(int number)
{
return number & 0xffff;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -