// Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.AccessKeyProperty) { return(Misc.AccessKey(Text)); } else if (idProp == AutomationElement.IsOffscreenProperty) { NativeMethods.Win32Rect itemRect = BoundingRect(); if (itemRect.IsEmpty) { return(true); } // Need to check if this item is visible on the whole control not just its immediate parent. IntPtr hwndParent = Misc.GetParent(_hwnd); if (hwndParent != IntPtr.Zero) { NativeMethods.Win32Rect parentRect = NativeMethods.Win32Rect.Empty; if (Misc.GetClientRectInScreenCoordinates(hwndParent, ref parentRect) && !parentRect.IsEmpty) { if (!Misc.IsItemVisible(ref parentRect, ref itemRect)) { return(true); } } } } return(base.GetElementProperty(idProp)); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.AccessKeyProperty) { return(Misc.AccessKey(Misc.ProxyGetText(_hwnd))); } return(base.GetElementProperty(idProp)); }
// Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.AccessKeyProperty && _windowsForms != WindowsFormsHelper.FormControlState.True) { return(Misc.AccessKey(WindowsTabItem.GetItemText(_hwnd, _item))); } else if (idProp == AutomationElement.IsControlElementProperty) { return(!string.IsNullOrEmpty(GetName(_hwnd, _item, true))); } return(base.GetElementProperty(idProp)); }
internal virtual string GetAccessKey() { // If the control is part of a dialog box or a form, // get the accelerator from the static preceding that control // on the dialog. if (GetParent() == null && (bool)GetElementProperty(AutomationElement.IsKeyboardFocusableProperty)) { string sRawName = Misc.GetControlName(_hwnd, false); return(string.IsNullOrEmpty(sRawName) ? null : Misc.AccessKey(sRawName)); } return(null); }
// ------------------------------------------------------ // // Private Methods // // ------------------------------------------------------ #region Private Methods // Get the access key of the associated label (if there is // an associated label). static protected string GetLabelAccessKey(IntPtr hwnd) { string accessKey = string.Empty; IntPtr label = Misc.GetLabelhwnd(hwnd); if (label != IntPtr.Zero) { string labelText = Misc.ProxyGetText(label); if (!string.IsNullOrEmpty(labelText)) { accessKey = Misc.AccessKey(labelText); } } return(accessKey); }
// Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.AccessKeyProperty) { return(Misc.AccessKey(Text)); } else if (idProp == AutomationElement.IsControlElementProperty) { return(_cControlType != ControlType.Separator); } else if (idProp == AutomationElement.IsEnabledProperty) { return(Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONENABLED, new IntPtr(_idCommand), IntPtr.Zero) != 0); } return(base.GetElementProperty(idProp)); }
// Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.AccessKeyProperty) { // Special handling for forms if (!WindowsFormsHelper.IsWindowsFormsControl(_hwnd, ref _windowsForms) && IsStartButton()) { // Hard coded shortcut for the start button return(ST.Get(STID.KeyCtrl) + " + " + ST.Get(STID.KeyEsc)); } return(Misc.AccessKey(Misc.ProxyGetText(_hwnd))); } else if (idProp == AutomationElement.IsEnabledProperty) { if (InShellTray()) { return(SafeNativeMethods.IsWindowVisible(_hwnd)); } } return(base.GetElementProperty(idProp)); }