// This is new with v6 comctrl on Vista private void ClickSplitButton() { // Make sure that the control is enabled if (!SafeNativeMethods.IsWindowEnabled(_hwnd)) { throw new ElementNotEnabledException(); } WindowsSysHeader parent = _parent as WindowsSysHeader; if (parent != null) { parent.ScrollIntoView(this); } Rect rect = XSendMessage.GetItemRect(_hwnd, NativeMethods.HDM_GETITEMDROPDOWNRECT, _item); NativeMethods.Win32Rect rectW32 = new NativeMethods.Win32Rect(rect); IntPtr center = NativeMethods.Util.MAKELPARAM(rectW32.left + ((rectW32.right - rectW32.left) / 2), rectW32.top + ((rectW32.bottom - rectW32.top) / 2)); // click // This code does not seem to work Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONDOWN, new IntPtr(NativeMethods.MK_LBUTTON), center); Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONUP, IntPtr.Zero, center); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Retrieves the bounding rectangle of the Status Bar Pane. static internal Rect GetBoundingRectangle(IntPtr hwnd, int item) { if (!WindowsFormsHelper.IsWindowsFormsControl(hwnd)) { return(XSendMessage.GetItemRect(hwnd, NativeMethods.SB_GETRECT, item)); } else { Accessible acc = null; if (Accessible.AccessibleObjectFromWindow(hwnd, NativeMethods.OBJID_CLIENT, ref acc) != NativeMethods.S_OK || acc == null) { return(Rect.Empty); } else { // OLEACC's Win32 proxy does use a 1, 2, 3... scheme, but the [....] // controls in some cases supply their own children, using a different scheme. // Using the "ByIndex" approach avoids having to know what the underlying // object's idChild scheme is. acc = Accessible.GetFullAccessibleChildByIndex(acc, item); if (acc == null) { return(Rect.Empty); } else { return(acc.Location); } } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Returns the bounding rectangle of the control. internal static Rect GetBoundingRectangle(IntPtr hwnd, int item) { return(XSendMessage.GetItemRect(hwnd, NativeMethods.TB_GETITEMRECT, item)); }