Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ScrollableControlDesigner.cs / 1 / ScrollableControlDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System.Design; using System.Runtime.Serialization.Formatters; using System.ComponentModel; using System.Diagnostics; using System; using System.ComponentModel.Design; using System.Windows.Forms; using System.Windows.Forms.Design.Behavior; using System.Drawing; using Microsoft.Win32; ////// /// The ScrollableControlDesigner class builds on the ParentControlDesigner, and adds the implementation /// of IWinFormsDesigner so that the designer can be hosted as a document. /// public class ScrollableControlDesigner : ParentControlDesigner { private SelectionManager selManager; ////// /// Overrides the base class's GetHitTest method to determine regions of the /// control that should always be UI-Active. For a form, if it has autoscroll /// set the scroll bars are always UI active. /// protected override bool GetHitTest(Point pt) { if (base.GetHitTest(pt)) { return true; } // The scroll bars on a form are "live" // ScrollableControl f = (ScrollableControl)Control; if (f.IsHandleCreated && f.AutoScroll) { int hitTest = (int)NativeMethods.SendMessage(f.Handle, NativeMethods.WM_NCHITTEST, (IntPtr)0, (IntPtr)NativeMethods.Util.MAKELPARAM(pt.X, pt.Y)); if (hitTest == NativeMethods.HTVSCROLL || hitTest == NativeMethods.HTHSCROLL) { return true; } } return false; } ////// /// We override our base class's WndProc to monitor certain messages. /// protected override void WndProc(ref Message m) { base.WndProc(ref m); switch(m.Msg) { case NativeMethods.WM_HSCROLL: case NativeMethods.WM_VSCROLL: // When we scroll, we reposition a control without causing a // property change event. Therefore, we must tell the // SelectionManager to refresh its glyphs. if (selManager == null) { selManager = GetService(typeof(SelectionManager)) as SelectionManager; } if (selManager != null) { selManager.Refresh(); } // Now we must paint our adornments, since the scroll does not // trigger a paint event // Control.Invalidate(); Control.Update(); break; } } } } // 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
- CompilationLock.cs
- XmlSchemaAttributeGroupRef.cs
- HyperlinkAutomationPeer.cs
- Int64KeyFrameCollection.cs
- LinqExpressionNormalizer.cs
- EventProviderTraceListener.cs
- coordinatorscratchpad.cs
- WindowInteractionStateTracker.cs
- Journal.cs
- ListChunk.cs
- SQLMembershipProvider.cs
- URLString.cs
- SetState.cs
- embossbitmapeffect.cs
- Assembly.cs
- WebPartCancelEventArgs.cs
- Point3DIndependentAnimationStorage.cs
- ClientUtils.cs
- CngProperty.cs
- ProviderBase.cs
- OciEnlistContext.cs
- UserControl.cs
- OrderByQueryOptionExpression.cs
- IncrementalReadDecoders.cs
- keycontainerpermission.cs
- InitializationEventAttribute.cs
- DoubleAnimationClockResource.cs
- SystemIcmpV6Statistics.cs
- ConfigurationElement.cs
- TextCharacters.cs
- CodeRegionDirective.cs
- IISMapPath.cs
- DataGridViewColumnConverter.cs
- Vector3DCollectionConverter.cs
- BitmapScalingModeValidation.cs
- TaiwanLunisolarCalendar.cs
- ADMembershipUser.cs
- XPathAncestorIterator.cs
- FtpWebRequest.cs
- DBSchemaTable.cs
- AmbientValueAttribute.cs
- DataGridViewImageCell.cs
- ValueUtilsSmi.cs
- RelatedCurrencyManager.cs
- _NtlmClient.cs
- SubMenuStyleCollection.cs
- OrderedEnumerableRowCollection.cs
- WebContext.cs
- SqlBinder.cs
- OleDbStruct.cs
- FixedSOMTableCell.cs
- UnsafeNativeMethods.cs
- AppearanceEditorPart.cs
- UrlAuthFailureHandler.cs
- SemaphoreSlim.cs
- MinimizableAttributeTypeConverter.cs
- KeyedCollection.cs
- TypeGeneratedEventArgs.cs
- FontStretches.cs
- HttpHandlersSection.cs
- SystemInformation.cs
- x509utils.cs
- XmlNodeList.cs
- NameObjectCollectionBase.cs
- DoubleUtil.cs
- ExpressionVisitorHelpers.cs
- MetadataItemEmitter.cs
- WinEventTracker.cs
- WebBrowserUriTypeConverter.cs
- COM2PropertyDescriptor.cs
- Lazy.cs
- SafeThreadHandle.cs
- PeerInvitationResponse.cs
- TextEditorCharacters.cs
- CacheHelper.cs
- Int16.cs
- RegistrySecurity.cs
- backend.cs
- XmlAnyAttributeAttribute.cs
- LayoutSettings.cs
- XmlSignificantWhitespace.cs
- QueryStack.cs
- BuildResultCache.cs
- ByteStream.cs
- _ProxyRegBlob.cs
- SelectedDatesCollection.cs
- StylusPointCollection.cs
- OrderedEnumerableRowCollection.cs
- DropSourceBehavior.cs
- RewritingValidator.cs
- GeneralTransform3D.cs
- WindowsTooltip.cs
- CollectionViewGroupRoot.cs
- BaseCodeDomTreeGenerator.cs
- XPathSelfQuery.cs
- EventItfInfo.cs
- CookieParameter.cs
- SamlAuthorizationDecisionStatement.cs
- UserControlAutomationPeer.cs
- WebPartCloseVerb.cs