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
- Oci.cs
- NotifyParentPropertyAttribute.cs
- HttpProfileGroupBase.cs
- GeometryModel3D.cs
- ComplexType.cs
- XXXOnTypeBuilderInstantiation.cs
- ProviderConnectionPoint.cs
- NTAccount.cs
- WebControlAdapter.cs
- CheckedListBox.cs
- ConfigXmlText.cs
- KeyGestureValueSerializer.cs
- ProgressBarAutomationPeer.cs
- DefaultObjectMappingItemCollection.cs
- FileLogRecord.cs
- RequestCache.cs
- HttpsHostedTransportConfiguration.cs
- RuntimeHelpers.cs
- TransformGroup.cs
- cookiecollection.cs
- DatePicker.cs
- CqlLexer.cs
- FormsAuthenticationEventArgs.cs
- ListViewCancelEventArgs.cs
- ShaperBuffers.cs
- DbProviderFactoriesConfigurationHandler.cs
- ErrorStyle.cs
- DbDeleteCommandTree.cs
- _ListenerResponseStream.cs
- ContextDataSource.cs
- IsolatedStorageFilePermission.cs
- HighlightVisual.cs
- OleDbEnumerator.cs
- HealthMonitoringSectionHelper.cs
- StatusBar.cs
- XmlElementList.cs
- XmlBoundElement.cs
- SchemaRegistration.cs
- WebPartHelpVerb.cs
- _CookieModule.cs
- TimeManager.cs
- SmiEventSink_DeferedProcessing.cs
- Attachment.cs
- NavigatingCancelEventArgs.cs
- FileSecurity.cs
- ImageButton.cs
- HTTPRemotingHandler.cs
- ReadWriteSpinLock.cs
- UpdateDelegates.Generated.cs
- StandardMenuStripVerb.cs
- ScriptingScriptResourceHandlerSection.cs
- NaturalLanguageHyphenator.cs
- XhtmlBasicValidationSummaryAdapter.cs
- KnownTypesProvider.cs
- App.cs
- ObjectDataSourceStatusEventArgs.cs
- GradientStop.cs
- ValidationEventArgs.cs
- UTF8Encoding.cs
- PointKeyFrameCollection.cs
- SerializableAttribute.cs
- PreviewPrintController.cs
- XmlSchemaSimpleContentRestriction.cs
- RegistrySecurity.cs
- ApplyImportsAction.cs
- WebPartPersonalization.cs
- StorageSetMapping.cs
- TextFindEngine.cs
- OracleMonthSpan.cs
- SerializableAttribute.cs
- BasicHttpBinding.cs
- SafeUserTokenHandle.cs
- SynchronizedDispatch.cs
- UiaCoreProviderApi.cs
- ConvertEvent.cs
- TextFormatterContext.cs
- FixedTextSelectionProcessor.cs
- ObjectRef.cs
- ConfigXmlComment.cs
- XmlUtilWriter.cs
- SqlLiftIndependentRowExpressions.cs
- CleanUpVirtualizedItemEventArgs.cs
- EndpointInstanceProvider.cs
- PtsPage.cs
- CodeThrowExceptionStatement.cs
- HeaderElement.cs
- Zone.cs
- RetrieveVirtualItemEventArgs.cs
- TypeConvertions.cs
- ECDsa.cs
- Int64Storage.cs
- ColumnResizeAdorner.cs
- Condition.cs
- BuildProvider.cs
- SQLSingleStorage.cs
- SmtpSection.cs
- DataServiceProviderMethods.cs
- SqlFileStream.cs
- SecurityUtils.cs
- JsonClassDataContract.cs