Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / Layout / LayoutEngine.cs / 1305376 / 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; } /// [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] 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
- ChannelServices.cs
- GeneralTransform3D.cs
- DependencyPropertyValueSerializer.cs
- MethodBuilder.cs
- OleDbTransaction.cs
- GenerateScriptTypeAttribute.cs
- XmlSchemaImport.cs
- InputLanguageProfileNotifySink.cs
- OleDbMetaDataFactory.cs
- WinFormsComponentEditor.cs
- MessageEnumerator.cs
- RotationValidation.cs
- TemplateEditingFrame.cs
- Array.cs
- Control.cs
- TextEditorContextMenu.cs
- TypeProvider.cs
- DesignerUtility.cs
- DataColumnChangeEvent.cs
- Stream.cs
- Emitter.cs
- ScriptingSectionGroup.cs
- CodeIndexerExpression.cs
- ParserContext.cs
- XmlSchemaSequence.cs
- SiteMapPathDesigner.cs
- DynamicPhysicalDiscoSearcher.cs
- NetCodeGroup.cs
- CommandField.cs
- CodeAttributeDeclarationCollection.cs
- DataPointer.cs
- RectAnimationUsingKeyFrames.cs
- ManagedWndProcTracker.cs
- ImageListStreamer.cs
- BuildProviderUtils.cs
- ConstructorBuilder.cs
- _NetworkingPerfCounters.cs
- CounterSampleCalculator.cs
- ExpressionLexer.cs
- PropertyConverter.cs
- ToolZone.cs
- PartialArray.cs
- MutexSecurity.cs
- InstanceView.cs
- PropertyItem.cs
- UriExt.cs
- Parsers.cs
- Misc.cs
- FrameDimension.cs
- LoginUtil.cs
- TableItemProviderWrapper.cs
- SegmentTree.cs
- BitmapEffectGeneralTransform.cs
- ObjectContextServiceProvider.cs
- ProviderConnectionPoint.cs
- Baml2006ReaderSettings.cs
- SQLUtility.cs
- DataGridViewCellStyleChangedEventArgs.cs
- FrameworkElementFactory.cs
- IPGlobalProperties.cs
- ServiceContractListItem.cs
- DataSourceProvider.cs
- TypeUtil.cs
- IntegerValidatorAttribute.cs
- ModelItemKeyValuePair.cs
- JavaScriptString.cs
- ModelPerspective.cs
- StructuralCache.cs
- ActivityAction.cs
- QuaternionConverter.cs
- ImageFormat.cs
- Byte.cs
- TransformCryptoHandle.cs
- Application.cs
- GroupItem.cs
- OrCondition.cs
- IdentitySection.cs
- InplaceBitmapMetadataWriter.cs
- XPathAncestorIterator.cs
- Accessible.cs
- Converter.cs
- XmlSchemaAppInfo.cs
- HorizontalAlignConverter.cs
- DbParameterCollection.cs
- TypeValidationEventArgs.cs
- CharStorage.cs
- WebPartCloseVerb.cs
- StrongNameUtility.cs
- StatusBarDrawItemEvent.cs
- StrongBox.cs
- ExplicitDiscriminatorMap.cs
- RowToParametersTransformer.cs
- PriorityBindingExpression.cs
- X509Certificate2.cs
- shaperfactoryquerycachekey.cs
- HtmlFormAdapter.cs
- GridViewCancelEditEventArgs.cs
- WorkflowEventArgs.cs
- Pool.cs
- UnsafePeerToPeerMethods.cs