Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- XmlSchemaInclude.cs
- EncoderNLS.cs
- TransactionFormatter.cs
- TextEffect.cs
- TableAdapterManagerMethodGenerator.cs
- SharedStatics.cs
- XmlWriterTraceListener.cs
- ContainerUIElement3D.cs
- CompilationUnit.cs
- ParentQuery.cs
- HexParser.cs
- SimpleHandlerFactory.cs
- ToolStrip.cs
- EventWaitHandle.cs
- TraceHandler.cs
- ColorConvertedBitmap.cs
- UIElement3D.cs
- CommandManager.cs
- Query.cs
- Shared.cs
- OletxTransactionManager.cs
- QilList.cs
- UserControlCodeDomTreeGenerator.cs
- SoapElementAttribute.cs
- CharacterMetrics.cs
- OperationCanceledException.cs
- ProcessModelInfo.cs
- CompiledQueryCacheKey.cs
- DataTemplateKey.cs
- RoutingExtension.cs
- HtmlTextViewAdapter.cs
- GraphicsContext.cs
- COM2ExtendedUITypeEditor.cs
- CompilerGlobalScopeAttribute.cs
- BindingOperations.cs
- ParseElementCollection.cs
- Group.cs
- JournalNavigationScope.cs
- FixedSOMTableRow.cs
- XmlQueryRuntime.cs
- X509Certificate.cs
- FileDialog_Vista_Interop.cs
- RegexMatch.cs
- RealizedColumnsBlock.cs
- SafeNativeMethods.cs
- AssemblyEvidenceFactory.cs
- SQLStringStorage.cs
- XmlSchemaSubstitutionGroup.cs
- SiteMapPathDesigner.cs
- LinkLabel.cs
- ChannelManager.cs
- HttpPostedFile.cs
- UniqueEventHelper.cs
- DrawingGroup.cs
- ObjectSpanRewriter.cs
- DocumentReference.cs
- DashStyles.cs
- SystemIPv6InterfaceProperties.cs
- Literal.cs
- CacheMode.cs
- NameValueConfigurationElement.cs
- ReplacementText.cs
- ControlAdapter.cs
- SizeF.cs
- DataSourceProvider.cs
- TdsParser.cs
- XmlValidatingReaderImpl.cs
- WebPartUserCapability.cs
- SystemThemeKey.cs
- TextDecorationCollection.cs
- RelatedPropertyManager.cs
- FactoryGenerator.cs
- EnumValAlphaComparer.cs
- ControlValuePropertyAttribute.cs
- CfgRule.cs
- StopRoutingHandler.cs
- JsonQueryStringConverter.cs
- TextBoxBase.cs
- StrokeNodeEnumerator.cs
- TranslateTransform.cs
- DateTimeValueSerializer.cs
- LinkTarget.cs
- basevalidator.cs
- DesignerSerializationOptionsAttribute.cs
- ClassicBorderDecorator.cs
- Page.cs
- WebPartDescription.cs
- TrimSurroundingWhitespaceAttribute.cs
- returneventsaver.cs
- CodeGen.cs
- COM2ComponentEditor.cs
- InstanceKeyNotReadyException.cs
- GeneralTransform3D.cs
- TextEditorDragDrop.cs
- HttpCapabilitiesSectionHandler.cs
- HashRepartitionEnumerator.cs
- ComplexPropertyEntry.cs
- WindowsAuthenticationEventArgs.cs
- NativeObjectSecurity.cs
- XmlWriterTraceListener.cs