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
- TemplateLookupAction.cs
- NameTable.cs
- ObjectPersistData.cs
- VisualStyleElement.cs
- initElementDictionary.cs
- CroppedBitmap.cs
- EventTask.cs
- Size3DConverter.cs
- ColumnReorderedEventArgs.cs
- SchemaImporterExtensionElementCollection.cs
- ConfigurationProperty.cs
- XmlSchemaImporter.cs
- XmlNodeList.cs
- ColumnMapVisitor.cs
- ConnectionPointCookie.cs
- XmlRawWriter.cs
- FontDriver.cs
- ListBox.cs
- CqlParser.cs
- SubpageParagraph.cs
- ToolStripHighContrastRenderer.cs
- WebServiceTypeData.cs
- FilteredAttributeCollection.cs
- EmbeddedMailObjectsCollection.cs
- ScrollProperties.cs
- TraceProvider.cs
- MatrixCamera.cs
- PrintPreviewControl.cs
- _SafeNetHandles.cs
- AspNetHostingPermission.cs
- ConfigXmlCDataSection.cs
- QilStrConcatenator.cs
- User.cs
- StringToken.cs
- GridItemPatternIdentifiers.cs
- EventLogPermission.cs
- FixedDocumentSequencePaginator.cs
- WebHostScriptMappingsInstallComponent.cs
- DataKey.cs
- DispatcherHooks.cs
- ReferencedCollectionType.cs
- RegistryPermission.cs
- BinaryObjectInfo.cs
- Restrictions.cs
- ExpressionBuilderContext.cs
- FunctionNode.cs
- PageThemeCodeDomTreeGenerator.cs
- DataServiceCollectionOfT.cs
- AutomationPropertyInfo.cs
- XmlReader.cs
- UInt16.cs
- EntityClientCacheEntry.cs
- DynamicExpression.cs
- StyleConverter.cs
- TextBox.cs
- BlobPersonalizationState.cs
- BaseUriHelper.cs
- SqlStatistics.cs
- FormViewInsertEventArgs.cs
- SystemNetworkInterface.cs
- ConnectionInterfaceCollection.cs
- RoutedEventArgs.cs
- SpellerStatusTable.cs
- CompilerError.cs
- ContainerControl.cs
- ApplicationManager.cs
- WeakEventManager.cs
- ImmutableCollection.cs
- HttpWebResponse.cs
- RSAPKCS1SignatureDeformatter.cs
- IdnMapping.cs
- XmlSchemaInfo.cs
- ArgIterator.cs
- TaskFileService.cs
- InputMethod.cs
- Util.cs
- AutoResizedEvent.cs
- XmlSignatureManifest.cs
- PenThreadWorker.cs
- ResourceDescriptionAttribute.cs
- DuplicateWaitObjectException.cs
- CoTaskMemUnicodeSafeHandle.cs
- Section.cs
- StackSpiller.Bindings.cs
- SelfIssuedAuthAsymmetricKey.cs
- SemanticAnalyzer.cs
- CellConstantDomain.cs
- CultureData.cs
- AsymmetricSignatureDeformatter.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- BaseProcessor.cs
- DataViewSetting.cs
- TypeContext.cs
- OutputCacheSettings.cs
- FormatSettings.cs
- RecordsAffectedEventArgs.cs
- ComMethodElement.cs
- UnicastIPAddressInformationCollection.cs
- BrowsableAttribute.cs
- TextServicesManager.cs