Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ObjectConverter.cs
- AppSettingsSection.cs
- SqlDeflator.cs
- CompensationParticipant.cs
- HyperLinkField.cs
- IFlowDocumentViewer.cs
- EditorPartCollection.cs
- PointAnimation.cs
- PropertyConverter.cs
- querybuilder.cs
- SoapSchemaImporter.cs
- AnimationException.cs
- GeneralTransform3DTo2D.cs
- RepeaterItemEventArgs.cs
- Funcletizer.cs
- ObjectDataSourceEventArgs.cs
- CallSite.cs
- Soap.cs
- GenericWebPart.cs
- WindowsComboBox.cs
- StringInfo.cs
- SmiContext.cs
- ToolboxComponentsCreatingEventArgs.cs
- TextTreeExtractElementUndoUnit.cs
- OracleBFile.cs
- Configuration.cs
- Context.cs
- WebEventTraceProvider.cs
- PrePrepareMethodAttribute.cs
- CoreChannel.cs
- TextLineBreak.cs
- MobileControlsSection.cs
- XamlPointCollectionSerializer.cs
- UrlMappingsModule.cs
- XamlSerializerUtil.cs
- PersonalizablePropertyEntry.cs
- ADMembershipUser.cs
- NameValueFileSectionHandler.cs
- ParameterDataSourceExpression.cs
- RuleSettingsCollection.cs
- ChtmlTextWriter.cs
- SqlRecordBuffer.cs
- diagnosticsswitches.cs
- EventSinkHelperWriter.cs
- XsdBuildProvider.cs
- Journal.cs
- DataBindEngine.cs
- FullTrustAssembly.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ToolStripGripRenderEventArgs.cs
- HotSpotCollection.cs
- UIElement.cs
- SiteIdentityPermission.cs
- PkcsMisc.cs
- IgnoreFileBuildProvider.cs
- ThemeDictionaryExtension.cs
- ProjectionPruner.cs
- XAMLParseException.cs
- SignedXmlDebugLog.cs
- RecordsAffectedEventArgs.cs
- ImageClickEventArgs.cs
- WebBrowserContainer.cs
- FormDocumentDesigner.cs
- BamlBinaryWriter.cs
- TextDecorationLocationValidation.cs
- OleAutBinder.cs
- Atom10FormatterFactory.cs
- SBCSCodePageEncoding.cs
- StylusPointPropertyId.cs
- DbConnectionOptions.cs
- TypedTableBaseExtensions.cs
- BindingEntityInfo.cs
- XmlValidatingReader.cs
- SerializationObjectManager.cs
- WebServiceEnumData.cs
- XhtmlBasicPhoneCallAdapter.cs
- CompilationLock.cs
- SpecialTypeDataContract.cs
- Lease.cs
- SHA512.cs
- CustomWebEventKey.cs
- DataBindingList.cs
- SqlInfoMessageEvent.cs
- SiteMapNodeItemEventArgs.cs
- Vector3DCollectionValueSerializer.cs
- Context.cs
- EventSinkActivityDesigner.cs
- XmlAggregates.cs
- StrokeNodeOperations.cs
- Relationship.cs
- OleDbCommand.cs
- WebBrowserDocumentCompletedEventHandler.cs
- Separator.cs
- InkCanvas.cs
- ExceptionCollection.cs
- counter.cs
- LingerOption.cs
- LazyTextWriterCreator.cs
- ThicknessAnimationBase.cs
- XmlLanguageConverter.cs