Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ZipIOBlockManager.cs
- ListViewCancelEventArgs.cs
- PersistChildrenAttribute.cs
- DataStorage.cs
- PolicyChain.cs
- XmlReader.cs
- WebBrowsableAttribute.cs
- CodeDefaultValueExpression.cs
- InternalSafeNativeMethods.cs
- MenuItemStyleCollection.cs
- UIPropertyMetadata.cs
- XmlToDatasetMap.cs
- CacheMemory.cs
- InlineCollection.cs
- ToolboxBitmapAttribute.cs
- ResolveRequestResponseAsyncResult.cs
- COM2TypeInfoProcessor.cs
- SqlProfileProvider.cs
- __Error.cs
- SignatureHelper.cs
- FileRegion.cs
- EdmConstants.cs
- DataGridViewRowConverter.cs
- TextContainerHelper.cs
- DataGridViewCellCancelEventArgs.cs
- InfoCard.cs
- ListViewContainer.cs
- HtmlInputRadioButton.cs
- TransformPattern.cs
- MaskedTextBoxTextEditorDropDown.cs
- WebControlAdapter.cs
- VersionPair.cs
- TimeZoneInfo.cs
- EntitySet.cs
- WorkflowItemPresenter.cs
- DtdParser.cs
- SmiEventSink_DeferedProcessing.cs
- transactioncontext.cs
- ReadOnlyHierarchicalDataSource.cs
- AuthorizationRule.cs
- XmlCompatibilityReader.cs
- FaultCode.cs
- controlskin.cs
- VectorKeyFrameCollection.cs
- CodeArrayIndexerExpression.cs
- ExpandCollapsePattern.cs
- CacheDependency.cs
- Context.cs
- FileDataSource.cs
- DataBoundControl.cs
- BufferedGraphicsManager.cs
- FastPropertyAccessor.cs
- EntityContainerEntitySetDefiningQuery.cs
- SupportsEventValidationAttribute.cs
- TextContainerHelper.cs
- RegexTree.cs
- ListViewItemCollectionEditor.cs
- filewebresponse.cs
- BuildResultCache.cs
- WebPartDescription.cs
- SafeReversePInvokeHandle.cs
- mediapermission.cs
- bindurihelper.cs
- XPathEmptyIterator.cs
- SystemIcons.cs
- FieldNameLookup.cs
- OciLobLocator.cs
- XmlQueryContext.cs
- TableLayoutCellPaintEventArgs.cs
- Propagator.Evaluator.cs
- DesigntimeLicenseContextSerializer.cs
- BasicViewGenerator.cs
- ImplicitInputBrush.cs
- SpeakInfo.cs
- Stack.cs
- BaseAddressElementCollection.cs
- AssociativeAggregationOperator.cs
- WindowAutomationPeer.cs
- CharEnumerator.cs
- DockProviderWrapper.cs
- ParameterToken.cs
- PropertyCondition.cs
- DelayedRegex.cs
- HtmlAnchor.cs
- OrderToken.cs
- SqlConnection.cs
- DesigntimeLicenseContextSerializer.cs
- DecodeHelper.cs
- MessageSecurityOverTcp.cs
- NetworkInformationPermission.cs
- SelectionPattern.cs
- ListItemConverter.cs
- XmlLanguage.cs
- EditorZone.cs
- GeneralTransform2DTo3D.cs
- CategoriesDocument.cs
- WebResourceAttribute.cs
- TabRenderer.cs
- WebUtil.cs
- Screen.cs