Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / Layout / LayoutEngine.cs / 1 / LayoutEngine.cs
//#define LAYOUT_PERFWATCH //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.Layout { using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Drawing; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Security.Permissions; ///public abstract class LayoutEngine { internal IArrangedElement CastToArrangedElement(object obj) { IArrangedElement element = obj as IArrangedElement; if(obj == null) { throw new NotSupportedException(SR.GetString(SR.LayoutEngineUnsupportedType, obj.GetType())); } return element; } internal virtual Size GetPreferredSize(IArrangedElement container, Size proposedConstraints) { return Size.Empty; } /// public virtual void InitLayout(object child, BoundsSpecified specified) { InitLayoutCore(CastToArrangedElement(child), specified); } internal virtual void InitLayoutCore(IArrangedElement element, BoundsSpecified bounds) {} internal virtual void ProcessSuspendedLayoutEventArgs(IArrangedElement container, LayoutEventArgs args) {} #if LAYOUT_PERFWATCH private static int LayoutWatch = 100; #endif /// [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] public virtual bool Layout(object container, LayoutEventArgs layoutEventArgs) { #if LAYOUT_PERFWATCH Debug.WriteLine(container.GetType().Name + "::Layout(" + (layoutEventArgs.AffectedControl != null ? layoutEventArgs.AffectedControl.Name : "null") + ", " + layoutEventArgs.AffectedProperty + ")"); Debug.Indent(); Stopwatch sw = new Stopwatch(); sw.Start(); #endif bool parentNeedsLayout = LayoutCore(CastToArrangedElement(container), layoutEventArgs); #if LAYOUT_PERFWATCH sw.Stop(); if (sw.ElapsedMilliseconds > LayoutWatch && Debugger.IsAttached) { Debugger.Break(); } Debug.Unindent(); Debug.WriteLine(container.GetType().Name + "::Layout elapsed " + sw.ElapsedMilliseconds.ToString() + " returned: " + parentNeedsLayout); #endif return parentNeedsLayout; } internal virtual bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) { return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //#define LAYOUT_PERFWATCH //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.Layout { using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Drawing; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Security.Permissions; ///public abstract class LayoutEngine { internal IArrangedElement CastToArrangedElement(object obj) { IArrangedElement element = obj as IArrangedElement; if(obj == null) { throw new NotSupportedException(SR.GetString(SR.LayoutEngineUnsupportedType, obj.GetType())); } return element; } internal virtual Size GetPreferredSize(IArrangedElement container, Size proposedConstraints) { return Size.Empty; } /// public virtual void InitLayout(object child, BoundsSpecified specified) { InitLayoutCore(CastToArrangedElement(child), specified); } internal virtual void InitLayoutCore(IArrangedElement element, BoundsSpecified bounds) {} internal virtual void ProcessSuspendedLayoutEventArgs(IArrangedElement container, LayoutEventArgs args) {} #if LAYOUT_PERFWATCH private static int LayoutWatch = 100; #endif /// [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] public virtual bool Layout(object container, LayoutEventArgs layoutEventArgs) { #if LAYOUT_PERFWATCH Debug.WriteLine(container.GetType().Name + "::Layout(" + (layoutEventArgs.AffectedControl != null ? layoutEventArgs.AffectedControl.Name : "null") + ", " + layoutEventArgs.AffectedProperty + ")"); Debug.Indent(); Stopwatch sw = new Stopwatch(); sw.Start(); #endif bool parentNeedsLayout = LayoutCore(CastToArrangedElement(container), layoutEventArgs); #if LAYOUT_PERFWATCH sw.Stop(); if (sw.ElapsedMilliseconds > LayoutWatch && Debugger.IsAttached) { Debugger.Break(); } Debug.Unindent(); Debug.WriteLine(container.GetType().Name + "::Layout elapsed " + sw.ElapsedMilliseconds.ToString() + " returned: " + parentNeedsLayout); #endif return parentNeedsLayout; } internal virtual bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) { return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XPathNavigatorReader.cs
- HasCopySemanticsAttribute.cs
- SafeNativeMethodsCLR.cs
- BinaryObjectReader.cs
- LinkedResourceCollection.cs
- MobileContainerDesigner.cs
- BinaryFormatterSinks.cs
- TypeResolver.cs
- SimpleBitVector32.cs
- IdentityReference.cs
- SizeChangedInfo.cs
- MenuEventArgs.cs
- IProvider.cs
- Image.cs
- FormViewUpdatedEventArgs.cs
- DataGridState.cs
- mediaeventshelper.cs
- AspNetCompatibilityRequirementsAttribute.cs
- IfAction.cs
- ListSortDescription.cs
- SeekableReadStream.cs
- FormatException.cs
- XmlSchemaInclude.cs
- ResourceAttributes.cs
- DiagnosticsConfigurationHandler.cs
- _AutoWebProxyScriptWrapper.cs
- WindowsButton.cs
- DependencyPropertyHelper.cs
- ListBoxAutomationPeer.cs
- HttpPostedFile.cs
- FontFaceLayoutInfo.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- NullableBoolConverter.cs
- RequiredFieldValidator.cs
- AdornerDecorator.cs
- RelationshipType.cs
- InternalTypeHelper.cs
- ExtensionQuery.cs
- ZipIOExtraField.cs
- Expression.cs
- CounterSetInstanceCounterDataSet.cs
- Point3D.cs
- ControlTemplate.cs
- StylusPlugin.cs
- ButtonChrome.cs
- StrictAndMessageFilter.cs
- ReadOnlyMetadataCollection.cs
- XmlSchemaException.cs
- WebPartMenu.cs
- RelationshipEnd.cs
- DrawItemEvent.cs
- VisualTreeFlattener.cs
- Operator.cs
- HostingEnvironmentSection.cs
- EmptyEnumerator.cs
- CharAnimationUsingKeyFrames.cs
- SQLGuid.cs
- Function.cs
- SafeNativeMethods.cs
- InputProcessorProfiles.cs
- Padding.cs
- RouteUrlExpressionBuilder.cs
- PagePropertiesChangingEventArgs.cs
- cryptoapiTransform.cs
- StylusEventArgs.cs
- ContentFilePart.cs
- DockPatternIdentifiers.cs
- XmlSchemaObjectTable.cs
- ByteConverter.cs
- WebPartsPersonalization.cs
- TextHintingModeValidation.cs
- CaseInsensitiveOrdinalStringComparer.cs
- MimeReflector.cs
- ResolveCompletedEventArgs.cs
- AssemblyNameProxy.cs
- counter.cs
- Utility.cs
- DataBindingHandlerAttribute.cs
- ConfigXmlText.cs
- AnnouncementClient.cs
- BufferedGraphicsManager.cs
- SqlCharStream.cs
- NullableDoubleAverageAggregationOperator.cs
- XmlSchemaAny.cs
- URL.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- ProfileInfo.cs
- ScriptingWebServicesSectionGroup.cs
- Bold.cs
- XamlGridLengthSerializer.cs
- AccessKeyManager.cs
- Scheduling.cs
- TempEnvironment.cs
- ImageKeyConverter.cs
- CheckBoxFlatAdapter.cs
- Int32.cs
- CodeExpressionCollection.cs
- AutoCompleteStringCollection.cs
- CultureSpecificCharacterBufferRange.cs
- TableItemPattern.cs