internal override UiaCore.IRawElementProviderFragment ElementProviderFromPoint(double x, double y) { int innerX = (int)x; int innerY = (int)y; ComCtl32.MCHITTESTINFO hitTestInfo = GetHitTestInfo(innerX, innerY); switch ((ComCtl32.MCHT)hitTestInfo.uHit) { case ComCtl32.MCHT.TITLEBTNPREV: return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.PreviousButton)); case ComCtl32.MCHT.TITLEBTNNEXT: return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.NextButton)); case ComCtl32.MCHT.TITLE: case ComCtl32.MCHT.TITLEMONTH: case ComCtl32.MCHT.TITLEYEAR: return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.CalendarHeader)); case ComCtl32.MCHT.CALENDARDAY: case ComCtl32.MCHT.CALENDARWEEKNUM: case ComCtl32.MCHT.CALENDARDATE: // Get calendar body's child. CalendarBodyAccessibleObject calendarBodyAccessibleObject = (CalendarBodyAccessibleObject)GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.CalendarBody); return(calendarBodyAccessibleObject.GetFromPoint(hitTestInfo)); case ComCtl32.MCHT.TODAYLINK: return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.TodayLink)); } return(base.ElementProviderFromPoint(x, y)); }
public ComCtl32.MCHITTESTINFO GetHitTestInfo(int xScreen, int yScreen) { ComCtl32.MCHITTESTINFO hitTestInfo = new ComCtl32.MCHITTESTINFO(); hitTestInfo.cbSize = (int)Marshal.SizeOf(hitTestInfo); hitTestInfo.pt = new POINT(); hitTestInfo.st = new Kernel32.SYSTEMTIME(); Point point = new Point(xScreen, yScreen); User32.MapWindowPoints(IntPtr.Zero, Handle, ref point, 1); hitTestInfo.pt.x = point.X; hitTestInfo.pt.y = point.Y; UnsafeNativeMethods.SendMessage(new HandleRef(this, Handle), (int)ComCtl32.MCM.HITTEST, 0, ref hitTestInfo); return(hitTestInfo); }
public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref ComCtl32.MCHITTESTINFO lParam);