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
- FilterEventArgs.cs
- FontWeight.cs
- FocusTracker.cs
- Block.cs
- SqlUtil.cs
- IgnoreFlushAndCloseStream.cs
- util.cs
- Double.cs
- ForeignConstraint.cs
- Nodes.cs
- StringTraceRecord.cs
- ReadContentAsBinaryHelper.cs
- InfoCardListRequest.cs
- FlowLayoutSettings.cs
- ExpressionParser.cs
- EntityDataSourceChangedEventArgs.cs
- CollectionChangeEventArgs.cs
- FormsIdentity.cs
- Matrix.cs
- Vector3DAnimationUsingKeyFrames.cs
- PerformanceCounterNameAttribute.cs
- SliderAutomationPeer.cs
- OleAutBinder.cs
- ValidatingPropertiesEventArgs.cs
- HttpCookie.cs
- grammarelement.cs
- TextServicesProperty.cs
- ListView.cs
- NativeMethods.cs
- EncodingTable.cs
- HotCommands.cs
- WebControl.cs
- Light.cs
- InvalidAsynchronousStateException.cs
- Rule.cs
- AutomationEvent.cs
- SerializationSectionGroup.cs
- WebPartDescription.cs
- messageonlyhwndwrapper.cs
- DoubleAnimationClockResource.cs
- ProfileProvider.cs
- XmlSortKey.cs
- WebConfigurationHostFileChange.cs
- AdornerHitTestResult.cs
- ClockGroup.cs
- MarkerProperties.cs
- PackWebRequestFactory.cs
- PointLightBase.cs
- PrimitiveXmlSerializers.cs
- DropSource.cs
- WebPartDescription.cs
- SoapSchemaImporter.cs
- StringToken.cs
- SqlAggregateChecker.cs
- WebPartEditorOkVerb.cs
- RectangleF.cs
- Stack.cs
- TablePattern.cs
- XhtmlBasicSelectionListAdapter.cs
- InterleavedZipPartStream.cs
- DataGridTablesFactory.cs
- NonClientArea.cs
- MessageSecurityOverMsmqElement.cs
- ListChangedEventArgs.cs
- DataGridViewTextBoxEditingControl.cs
- DataServiceSaveChangesEventArgs.cs
- _SingleItemRequestCache.cs
- RadioButtonPopupAdapter.cs
- SoapMessage.cs
- TextMarkerSource.cs
- TileBrush.cs
- ConfigXmlWhitespace.cs
- CodeTypeMemberCollection.cs
- SetterBaseCollection.cs
- WorkItem.cs
- CapiNative.cs
- WindowPatternIdentifiers.cs
- RC2.cs
- MergeLocalizationDirectives.cs
- httpapplicationstate.cs
- StatusStrip.cs
- EntityDataSourceMemberPath.cs
- PropertyTabAttribute.cs
- MatcherBuilder.cs
- DataGridViewCellParsingEventArgs.cs
- DiagnosticsElement.cs
- HttpConfigurationContext.cs
- ConfigurationSectionGroupCollection.cs
- StandardOleMarshalObject.cs
- ToolboxComponentsCreatingEventArgs.cs
- SqlErrorCollection.cs
- _IPv6Address.cs
- AdjustableArrowCap.cs
- ListBox.cs
- log.cs
- EntityAdapter.cs
- UrlEncodedParameterWriter.cs
- Int32RectValueSerializer.cs
- unsafeIndexingFilterStream.cs
- ScriptingAuthenticationServiceSection.cs