Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / AccessibleTech / longhorn / Automation / Win32Providers / MS / Internal / AutomationProxies / WindowsGrip.cs / 1 / WindowsGrip.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Windows Button Proxy // // History: // 07/01/2003 : [....] Created //--------------------------------------------------------------------------- using System; using System.Collections; using System.Text; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Provider; using System.ComponentModel; using MS.Win32; namespace MS.Internal.AutomationProxies { class WindowsGrip: ProxyFragment { // ----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors public WindowsGrip (IntPtr hwnd, ProxyHwnd parent, int item) : base( hwnd, parent, item) { _sType = ST.Get(STID.LocalizedControlTypeGrip); _sAutomationId = "Window.Grip"; // This string is a non-localizable string } #endregion //------------------------------------------------------ // // Patterns Implementation // //----------------------------------------------------- #region ProxySimple Interface ////// Gets the bounding rectangle for this element /// internal override Rect BoundingRectangle { get { if (IsGripPresent(_hwnd, false)) { NativeMethods.Win32Rect client = new NativeMethods.Win32Rect(); if (Misc.GetClientRectInScreenCoordinates(_hwnd, ref client)) { NativeMethods.SIZE sizeGrip = GetGripSize(_hwnd, false); if (Misc.IsLayoutRTL(_hwnd)) { return new Rect(client.left - sizeGrip.cx, client.bottom, sizeGrip.cx, sizeGrip.cy); } else { return new Rect(client.right, client.bottom, sizeGrip.cx, sizeGrip.cy); } } } return Rect.Empty; } } #endregion //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods static internal bool IsGripPresent(IntPtr hwnd, bool onStatusBar) { NativeMethods.Win32Rect client = new NativeMethods.Win32Rect(); if (!Misc.GetClientRectInScreenCoordinates(hwnd, ref client)) { return false; } // According to the documentation of GetClientRect, the left and top members are zero. So if // they are negitive the control must be minimized, therefore the grip is not present. if (client.left < 0 && client.top < 0 ) { return false; } NativeMethods.SIZE sizeGrip = GetGripSize(hwnd, onStatusBar); if (!onStatusBar) { // When not on a status bar the grip should be out side of the client area. sizeGrip.cx *= -1; sizeGrip.cy *= -1; } if (Misc.IsLayoutRTL(hwnd)) { int x = client.left + (int)(sizeGrip.cx / 2); int y = client.bottom - (int)(sizeGrip.cy / 2); int hit = Misc.ProxySendMessageInt(hwnd, NativeMethods.WM_NCHITTEST, IntPtr.Zero, NativeMethods.Util.MAKELPARAM(x, y)); return hit == NativeMethods.HTBOTTOMLEFT; } else { int x = client.right - (int)(sizeGrip.cx / 2); int y = client.bottom - (int)(sizeGrip.cy / 2); int hit = Misc.ProxySendMessageInt(hwnd, NativeMethods.WM_NCHITTEST, IntPtr.Zero, NativeMethods.Util.MAKELPARAM(x, y)); return hit == NativeMethods.HTBOTTOMRIGHT; } } internal static NativeMethods.SIZE GetGripSize(IntPtr hwnd, bool onStatusBar) { using (ThemePart themePart = new ThemePart(hwnd, onStatusBar ? "STATUS" : "SCROLLBAR")) { return themePart.Size(onStatusBar ? (int)ThemePart.STATUSPARTS.SP_GRIPPER : (int)ThemePart.SCROLLBARPARTS.SBP_SIZEBOX, 0); } } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VBCodeProvider.cs
- GeneralTransform3DGroup.cs
- NotifyIcon.cs
- TextEditorMouse.cs
- WebSysDescriptionAttribute.cs
- UIntPtr.cs
- FormsIdentity.cs
- XmlTextReaderImplHelpers.cs
- GridViewRowPresenter.cs
- SecurityHeaderTokenResolver.cs
- CompilationUnit.cs
- FontFaceLayoutInfo.cs
- CharConverter.cs
- FixedSOMElement.cs
- ImportContext.cs
- Axis.cs
- GeneralTransform3DTo2DTo3D.cs
- UriTemplateVariableQueryValue.cs
- SHA384Managed.cs
- DataBindingExpressionBuilder.cs
- URI.cs
- TagMapCollection.cs
- StyleHelper.cs
- StrokeRenderer.cs
- TextTreeTextNode.cs
- XmlILOptimizerVisitor.cs
- ResourceReferenceKeyNotFoundException.cs
- safesecurityhelperavalon.cs
- SqlCommandSet.cs
- ConvertEvent.cs
- MaxSessionCountExceededException.cs
- Container.cs
- MemberRelationshipService.cs
- CollaborationHelperFunctions.cs
- MultiByteCodec.cs
- PersonalizationProvider.cs
- SchemaDeclBase.cs
- DataGridRelationshipRow.cs
- BaseCollection.cs
- ToolStripControlHost.cs
- DataBoundLiteralControl.cs
- WindowsRichEdit.cs
- SystemColorTracker.cs
- IdentityElement.cs
- DecimalConverter.cs
- MetadataPropertyvalue.cs
- BaseCollection.cs
- BitmapMetadata.cs
- AggregationMinMaxHelpers.cs
- RequestCachePolicyConverter.cs
- ListChangedEventArgs.cs
- ByteConverter.cs
- BaseConfigurationRecord.cs
- EncodingDataItem.cs
- FilePrompt.cs
- IgnorePropertiesAttribute.cs
- WebPartTransformerAttribute.cs
- RoleExceptions.cs
- TemplateBuilder.cs
- UiaCoreApi.cs
- FormatException.cs
- printdlgexmarshaler.cs
- SqlClientWrapperSmiStream.cs
- UnitySerializationHolder.cs
- MessageDirection.cs
- DSACryptoServiceProvider.cs
- ListControlConvertEventArgs.cs
- TableItemProviderWrapper.cs
- ConnectionsZone.cs
- RequestUriProcessor.cs
- DictionaryManager.cs
- Lasso.cs
- SafeLibraryHandle.cs
- DBConcurrencyException.cs
- CapabilitiesRule.cs
- COM2FontConverter.cs
- AddDataControlFieldDialog.cs
- MeshGeometry3D.cs
- RelatedPropertyManager.cs
- HierarchicalDataSourceIDConverter.cs
- CacheDependency.cs
- StylusPointPropertyInfoDefaults.cs
- RuntimeWrappedException.cs
- SafeMILHandle.cs
- DesignOnlyAttribute.cs
- EventProviderBase.cs
- CustomError.cs
- MSAAEventDispatcher.cs
- TextServicesPropertyRanges.cs
- Thread.cs
- WebPartUserCapability.cs
- TextRange.cs
- XmlCharCheckingReader.cs
- BehaviorEditorPart.cs
- DescendantQuery.cs
- ToolStripDropDownItemDesigner.cs
- Evaluator.cs
- ForeignConstraint.cs
- WebControl.cs
- LogExtent.cs