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
- TextBox.cs
- KnownBoxes.cs
- UnsafeNativeMethods.cs
- CombinedHttpChannel.cs
- SpeakProgressEventArgs.cs
- DataGridViewIntLinkedList.cs
- KeyFrames.cs
- ComponentDispatcher.cs
- ContainerSelectorGlyph.cs
- Inline.cs
- FontStyleConverter.cs
- SuppressMergeCheckAttribute.cs
- ToolStripContainerDesigner.cs
- SystemIcmpV4Statistics.cs
- HashMembershipCondition.cs
- XmlMemberMapping.cs
- infer.cs
- PropertyTab.cs
- Pointer.cs
- XmlProcessingInstruction.cs
- Odbc32.cs
- ThousandthOfEmRealPoints.cs
- PathSegment.cs
- AssemblyAssociatedContentFileAttribute.cs
- SqlFunctionAttribute.cs
- TextRangeEdit.cs
- ScriptingSectionGroup.cs
- MulticastNotSupportedException.cs
- SystemSounds.cs
- ContextStack.cs
- LocalValueEnumerator.cs
- DynamicUpdateCommand.cs
- FileIOPermission.cs
- EncryptedPackageFilter.cs
- DbDeleteCommandTree.cs
- OleServicesContext.cs
- SoapReflectionImporter.cs
- AnnotationHelper.cs
- _Rfc2616CacheValidators.cs
- DesignRelationCollection.cs
- RecognizedPhrase.cs
- ZipFileInfo.cs
- DurableServiceAttribute.cs
- AssemblyHash.cs
- WindowsFormsHost.cs
- ExpressionBuilderContext.cs
- MailMessageEventArgs.cs
- AssociationType.cs
- Style.cs
- DbProviderServices.cs
- ToolboxDataAttribute.cs
- ToolStripHighContrastRenderer.cs
- PasswordRecovery.cs
- StringHelper.cs
- HostingEnvironment.cs
- ReflectEventDescriptor.cs
- SplitterEvent.cs
- XmlTypeAttribute.cs
- CalendarDataBindingHandler.cs
- QueryContinueDragEvent.cs
- ViewBase.cs
- ScriptHandlerFactory.cs
- CrossSiteScriptingValidation.cs
- SQLBinaryStorage.cs
- TagPrefixAttribute.cs
- SqlDelegatedTransaction.cs
- EditingCoordinator.cs
- JulianCalendar.cs
- TreeIterator.cs
- InfiniteIntConverter.cs
- DragEvent.cs
- WindowsFont.cs
- SimpleType.cs
- PageEventArgs.cs
- TreeNode.cs
- TextFindEngine.cs
- DataSourceCache.cs
- DataGridViewBindingCompleteEventArgs.cs
- ApplicationBuildProvider.cs
- PerformanceCounterPermissionEntryCollection.cs
- GradientBrush.cs
- HeaderLabel.cs
- InvalidPrinterException.cs
- XmlSerializerFormatAttribute.cs
- DbProviderFactories.cs
- WebBrowser.cs
- DynamicPropertyHolder.cs
- UserMapPath.cs
- DataGridHyperlinkColumn.cs
- GiveFeedbackEvent.cs
- WindowsTreeView.cs
- CommandEventArgs.cs
- TypeDescriptor.cs
- XmlMemberMapping.cs
- TextRangeEdit.cs
- BroadcastEventHelper.cs
- ExcludePathInfo.cs
- SingleTagSectionHandler.cs
- RawUIStateInputReport.cs
- TcpProcessProtocolHandler.cs