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
- SubqueryTrackingVisitor.cs
- StringKeyFrameCollection.cs
- ClientTargetCollection.cs
- PropertiesTab.cs
- BitmapMetadataEnumerator.cs
- WindowsAuthenticationModule.cs
- SafeCloseHandleCritical.cs
- Publisher.cs
- ChtmlCalendarAdapter.cs
- TextParagraphCache.cs
- DescendentsWalker.cs
- GridToolTip.cs
- CompressionTransform.cs
- DbInsertCommandTree.cs
- ComplexTypeEmitter.cs
- ADMembershipUser.cs
- RegexEditorDialog.cs
- Rectangle.cs
- QueryOperationResponseOfT.cs
- UnsafeNativeMethodsPenimc.cs
- CodeRemoveEventStatement.cs
- SerializationObjectManager.cs
- IIS7UserPrincipal.cs
- OdbcException.cs
- DefaultValueConverter.cs
- ResXResourceWriter.cs
- ToolZone.cs
- BackStopAuthenticationModule.cs
- ReadOnlyCollectionBuilder.cs
- PnrpPermission.cs
- RegionInfo.cs
- Method.cs
- DispatcherSynchronizationContext.cs
- Codec.cs
- NativeWindow.cs
- Style.cs
- HttpServerVarsCollection.cs
- StateItem.cs
- SoapAttributes.cs
- WorkflowViewManager.cs
- SqlNode.cs
- BuildProvider.cs
- UrlMappingsSection.cs
- XPathNodeList.cs
- DataGridViewComboBoxCell.cs
- DefaultHttpHandler.cs
- DPAPIProtectedConfigurationProvider.cs
- TableLayoutSettingsTypeConverter.cs
- AmbientProperties.cs
- ObjectStateFormatter.cs
- ReachDocumentPageSerializerAsync.cs
- QilTernary.cs
- AncestorChangedEventArgs.cs
- SecurityMessageProperty.cs
- ComponentCommands.cs
- XmlSchemaSimpleContentRestriction.cs
- Scene3D.cs
- HtmlImage.cs
- DataControlReference.cs
- FlagsAttribute.cs
- DBAsyncResult.cs
- FactoryRecord.cs
- UnionExpr.cs
- TimeStampChecker.cs
- GenericTextProperties.cs
- CodeAccessPermission.cs
- WebPartTransformerCollection.cs
- Quaternion.cs
- ChtmlPageAdapter.cs
- ResourceDescriptionAttribute.cs
- BulletedListEventArgs.cs
- LabelEditEvent.cs
- Deflater.cs
- SecurityException.cs
- InkCanvasInnerCanvas.cs
- FormViewDeletedEventArgs.cs
- ContextStack.cs
- DataSysAttribute.cs
- WinHttpWebProxyFinder.cs
- XamlReader.cs
- LabelDesigner.cs
- QuerySafeNavigator.cs
- Registry.cs
- AsymmetricAlgorithm.cs
- TrackBarRenderer.cs
- _ListenerRequestStream.cs
- Splitter.cs
- RtfNavigator.cs
- CatalogPartCollection.cs
- PageSettings.cs
- DataViewListener.cs
- SystemResourceKey.cs
- Invariant.cs
- SiteMapNode.cs
- PersonalizationStateQuery.cs
- FaultPropagationRecord.cs
- XmlWrappingWriter.cs
- HashStream.cs
- EventListenerClientSide.cs
- VectorCollection.cs