public override int HitTest(Point pt, bool screenCoords)
 {
     if(screenCoords) {
         PInvoke.ScreenToClient(ListViewController.Handle, ref pt);
     }
     LVHITTESTINFO structure = new LVHITTESTINFO {pt = pt};
     int num = (int)PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, IntPtr.Zero, ref structure);
     return num;
 }
 public int HitTest(Point pt, bool ScreenCoords) {
     if(ListViewController == null) {
         return -1;
     }
     else if(fIsSysListView) {
         if(ScreenCoords) {
             PInvoke.ScreenToClient(ListViewController.Handle, ref pt);
         }
         LVHITTESTINFO structure = new LVHITTESTINFO();
         structure.pt.x = pt.X;
         structure.pt.y = pt.Y;
         IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr, false);
         int num = (int)PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, IntPtr.Zero, ptr);
         Marshal.FreeHGlobal(ptr);
         return num;
     }
     else {
         if(!ScreenCoords) {
             PInvoke.ClientToScreen(ListViewController.Handle, ref pt);
         }
         return AutoMan.DoQuery<int>(factory => {
             AutomationElement elem = ListItemElementFromPoint(factory, pt);
             return elem == null ? -1 : elem.GetItemIndex();
         });
     }
 }
 public override bool PointIsBackground(Point pt, bool screenCoords) {
     if(screenCoords) {
         PInvoke.ScreenToClient(ListViewController.Handle, ref pt);
     }
     LVHITTESTINFO structure = new LVHITTESTINFO {pt = pt};
     if(QTUtility.IsXP) {
         return -1 == (int)PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, IntPtr.Zero, ref structure);
     }
     else {
         PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, (IntPtr)(-1), ref structure);
         return structure.flags == 1 /* LVHT_NOWHERE */;
     }
 }
Exemple #4
0
 public static int ListView_HitTest(IntPtr hwnd, IntPtr lParam) {
     LVHITTESTINFO structure = new LVHITTESTINFO();
     structure.pt = QTUtility2.PointFromLPARAM(lParam);
     IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
     Marshal.StructureToPtr(structure, ptr, false);
     int num = (int)SendMessage(hwnd, 0x1012, IntPtr.Zero, ptr);
     Marshal.FreeHGlobal(ptr);
     return num;
 }
 public override bool PointIsBackground(Point pt, bool screenCoords) {
     if(screenCoords) {
         PInvoke.ScreenToClient(ListViewController.Handle, ref pt);
     }
     LVHITTESTINFO structure = new LVHITTESTINFO();
     structure.pt = pt;
     IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
     Marshal.StructureToPtr(structure, ptr, false);
     if(!QTUtility.IsXP) {
         PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, (IntPtr)(-1), ptr);
         structure = (LVHITTESTINFO)Marshal.PtrToStructure(ptr, typeof(LVHITTESTINFO));
         Marshal.FreeHGlobal(ptr);
         return structure.flags == 1 /* LVHT_NOWHERE */;
     }
     else {
         int num = (int)PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, IntPtr.Zero, ptr);
         Marshal.FreeHGlobal(ptr);
         return num == -1;
     }
 }
 public override int HitTest(Point pt, bool screenCoords) {
     if(screenCoords) {
         PInvoke.ScreenToClient(ListViewController.Handle, ref pt);
     }
     LVHITTESTINFO structure = new LVHITTESTINFO();
     structure.pt = pt;
     IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
     Marshal.StructureToPtr(structure, ptr, false);
     int num = (int)PInvoke.SendMessage(ListViewController.Handle, LVM.HITTEST, IntPtr.Zero, ptr);
     Marshal.FreeHGlobal(ptr);
     return num;
 }