Code:
/ DotNET / DotNET / 8.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
- ChangeBlockUndoRecord.cs
- Processor.cs
- Delay.cs
- AnimationTimeline.cs
- DropShadowBitmapEffect.cs
- Marshal.cs
- PersonalizationStateInfo.cs
- XmlNavigatorFilter.cs
- XhtmlBasicLinkAdapter.cs
- WindowsAuthenticationModule.cs
- InputLanguageEventArgs.cs
- ToolStripItemDataObject.cs
- SizeConverter.cs
- Image.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- DeflateEmulationStream.cs
- Subset.cs
- AppSettingsReader.cs
- TextElementEnumerator.cs
- HttpProfileBase.cs
- RichTextBoxAutomationPeer.cs
- AttachedPropertyBrowsableAttribute.cs
- Grammar.cs
- BindToObject.cs
- Wow64ConfigurationLoader.cs
- DrawingGroupDrawingContext.cs
- Tracer.cs
- DragEventArgs.cs
- FrameworkName.cs
- TextHidden.cs
- NetCodeGroup.cs
- BounceEase.cs
- D3DImage.cs
- IDReferencePropertyAttribute.cs
- MultipartIdentifier.cs
- Wow64ConfigurationLoader.cs
- SchemaMapping.cs
- JsonFormatMapping.cs
- EmptyStringExpandableObjectConverter.cs
- CodeTryCatchFinallyStatement.cs
- WebPartConnection.cs
- Section.cs
- Resources.Designer.cs
- SmtpDigestAuthenticationModule.cs
- FreezableOperations.cs
- PropertyTabAttribute.cs
- DbParameterHelper.cs
- HtmlHistory.cs
- SEHException.cs
- SqlCharStream.cs
- ZoneLinkButton.cs
- NoneExcludedImageIndexConverter.cs
- ImageEditor.cs
- DataKeyCollection.cs
- ConstructorExpr.cs
- AutoCompleteStringCollection.cs
- Sql8ExpressionRewriter.cs
- figurelength.cs
- PersonalizationProviderCollection.cs
- SerializerProvider.cs
- DataTableReaderListener.cs
- ColorAnimation.cs
- TableLayout.cs
- TemplateContainer.cs
- ExpressionPrinter.cs
- ProviderConnectionPointCollection.cs
- ChangeTracker.cs
- CodeChecksumPragma.cs
- TextEditorTables.cs
- XmlWhitespace.cs
- WebPartCatalogCloseVerb.cs
- FileVersionInfo.cs
- PrimaryKeyTypeConverter.cs
- ModifierKeysValueSerializer.cs
- BackgroundWorker.cs
- HotSpotCollection.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- HopperCache.cs
- PlaceHolder.cs
- SmiContextFactory.cs
- SqlUserDefinedTypeAttribute.cs
- DataServices.cs
- WebServiceFault.cs
- TraversalRequest.cs
- PasswordRecovery.cs
- DynamicDataResources.Designer.cs
- RSACryptoServiceProvider.cs
- ParallelEnumerable.cs
- CodeIdentifiers.cs
- PerformanceCounterPermissionEntryCollection.cs
- RevocationPoint.cs
- PartDesigner.cs
- DeclarationUpdate.cs
- SafeEventLogReadHandle.cs
- ObjectIDGenerator.cs
- ElementNotEnabledException.cs
- xmlfixedPageInfo.cs
- DbParameterHelper.cs
- HttpListenerException.cs
- ExpandCollapsePattern.cs