コード例 #1
0
            // 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);
            }
コード例 #2
0
            // Same as a click on one of the header element
            void IInvokeProvider.Invoke()
            {
                // 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);
                }

                NativeMethods.Win32Point pt;

                if (!GetInvokationPoint(out pt))
                {
                    throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
                }

                IntPtr center = NativeMethods.Util.MAKELPARAM(pt.x, pt.y);

                // click
                Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONDOWN, new IntPtr(NativeMethods.MK_LBUTTON), center);
                Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONUP, IntPtr.Zero, center);
            }
コード例 #3
0
        internal static IRawElementProviderSimple Create(IntPtr hwnd, int idChild)
        {
            WindowsSysHeader header = new WindowsSysHeader(hwnd);

            if (idChild != 0)
            {
                return(header.CreateHeaderItem(idChild - 1));
            }

            return(header);
        }
コード例 #4
0
        IRawElementProviderSimple [] ITableItemProvider.GetColumnHeaderItems()
        {
            IntPtr hwndHeader = WindowsListView.ListViewGetHeader(_hwnd);

            if (SafeNativeMethods.IsWindowVisible(hwndHeader))
            {
                WindowsSysHeader header = (WindowsSysHeader)WindowsSysHeader.Create(hwndHeader, 0);
                return(new IRawElementProviderSimple [] { new WindowsSysHeader.HeaderItem(hwndHeader, header, _item) });
            }
            return(null);
        }
コード例 #5
0
        internal static IRawElementProviderSimple Create(IntPtr hwnd, int idChild)
        {
            WindowsSysHeader header = new WindowsSysHeader(hwnd);

            if (idChild != 0)
            {
                return header.CreateHeaderItem(idChild - 1);
            }

            return header;
        }
コード例 #6
0
 internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
 {
     if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
     {
         ProxyFragment      header   = new WindowsSysHeader(hwnd);
         AutomationProperty property = idProp as AutomationProperty;
         if (property == TablePattern.ColumnHeadersProperty || property == TablePattern.RowHeadersProperty)
         {
             // Check if the parent is a ListView
             IntPtr hwndParent = NativeMethodsSetLastError.GetAncestor(hwnd, NativeMethods.GA_PARENT);
             if (hwndParent != IntPtr.Zero)
             {
                 if (Misc.GetClassName(hwndParent).IndexOf("SysListView32", StringComparison.Ordinal) >= 0)
                 {
                     // Notify the Listview that the header Change
                     WindowsListView wlv = (WindowsListView)WindowsListView.Create(hwndParent, 0);
                     if (wlv != null)
                     {
                         wlv.DispatchEvents(eventId, idProp, idObject, idChild);
                     }
                 }
             }
         }
         else
         {
             if (idProp == InvokePattern.InvokedEvent)
             {
                 ProxySimple headerItem = new HeaderItem(hwnd, header, idChild);
                 headerItem.DispatchEvents(eventId, idProp, idObject, idChild);
             }
             else
             {
                 header.DispatchEvents(eventId, idProp, idObject, idChild);
             }
         }
     }
 }
コード例 #7
0
 internal static void RaiseEvents (IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
 {
     if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
     {
         ProxyFragment header = new WindowsSysHeader(hwnd);
         AutomationProperty property = idProp as AutomationProperty;
         if (property == TablePattern.ColumnHeadersProperty || property == TablePattern.RowHeadersProperty)
         {
             // Check if the parent is a ListView
             IntPtr hwndParent = NativeMethodsSetLastError.GetAncestor (hwnd, NativeMethods.GA_PARENT);
             if (hwndParent != IntPtr.Zero)
             {
                 if (Misc.GetClassName(hwndParent).IndexOf("SysListView32", StringComparison.Ordinal) >= 0)
                 {
                     // Notify the Listview that the header Change
                     WindowsListView wlv = (WindowsListView) WindowsListView.Create (hwndParent, 0);
                     if (wlv != null)
                     {
                         wlv.DispatchEvents (eventId, idProp, idObject, idChild);
                     }
                 }
             }
         }
         else
         {
             if (idProp == InvokePattern.InvokedEvent)
             {
                 ProxySimple headerItem = new HeaderItem(hwnd, header, idChild);
                 headerItem.DispatchEvents(eventId, idProp, idObject, idChild);
             }
             else
             {
                 header.DispatchEvents(eventId, idProp, idObject, idChild);
             }
         }
     }
 }