/// <summary> /// Indicates whether a mouse click at the specified point should be handled by the control. /// </summary> /// <param name="point">A <see cref="T:System.Drawing.Point" /> indicating the position at which the mouse was clicked, in screen coordinates.</param> /// <returns>true if a click at the specified point is to be handled by the control; otherwise, false.</returns> protected override bool GetHitTest(Point point) { if (this.SelectionService.PrimarySelection == this.Control) { var hti = new WinApi.TCHITTESTINFO { pt = this.Control.PointToClient(point), flags = 0 }; var m = new Message { HWnd = this.Control.Handle, Msg = WinApi.TCM_HITTEST }; var lparam = Marshal.AllocHGlobal(Marshal.SizeOf(hti)); Marshal.StructureToPtr(hti, lparam, false); m.LParam = lparam; base.WndProc(ref m); Marshal.FreeHGlobal(lparam); if (m.Result.ToInt32() != -1) { return(hti.flags != (int)WinApi.TabControlHitTest.TCHT_NOWHERE); } } return(false); }
protected override bool GetHitTest(System.Drawing.Point point) { if (SelectionService.PrimarySelection == Control) { WinApi.TCHITTESTINFO hti = new WinApi.TCHITTESTINFO { pt = Control.PointToClient(point), flags = 0 }; Message m = new Message { HWnd = Control.Handle, Msg = WinApi.TCM_HITTEST }; IntPtr lparam = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(hti)); System.Runtime.InteropServices.Marshal.StructureToPtr(hti, lparam, false); m.LParam = lparam; base.WndProc(ref m); System.Runtime.InteropServices.Marshal.FreeHGlobal(lparam); if (m.Result.ToInt32() != -1) { return(hti.flags != (int)WinApi.TabControlHitTest.TCHT_NOWHERE); } } return(false); }
protected override bool GetHitTest(Point point) { if (this.SelectionService.PrimarySelection == this.Control) { WinApi.TCHITTESTINFO tCHITTESTINFO = new WinApi.TCHITTESTINFO() { pt = this.Control.PointToClient(point), flags = 0 }; WinApi.TCHITTESTINFO tCHITTESTINFO1 = tCHITTESTINFO; Message message = new Message() { HWnd = this.Control.Handle, Msg = 4883 }; Message message1 = message; IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tCHITTESTINFO1)); Marshal.StructureToPtr(tCHITTESTINFO1, intPtr, false); message1.LParam = intPtr; base.WndProc(ref message1); Marshal.FreeHGlobal(intPtr); if (message1.Result.ToInt32() != -1) { return(tCHITTESTINFO1.flags != 1); } } return(false); }