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
- DataGridViewRowPrePaintEventArgs.cs
- nulltextcontainer.cs
- DataGridViewAccessibleObject.cs
- FocusManager.cs
- StorageEntityTypeMapping.cs
- SqlException.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- CodeArgumentReferenceExpression.cs
- ConsoleTraceListener.cs
- DocumentXPathNavigator.cs
- ExpressionDumper.cs
- BamlRecordHelper.cs
- DropShadowEffect.cs
- HotCommands.cs
- SystemKeyConverter.cs
- ExtentJoinTreeNode.cs
- DataControlFieldCell.cs
- translator.cs
- WebPartTransformerAttribute.cs
- VisualBasicImportReference.cs
- GestureRecognitionResult.cs
- TraceSource.cs
- EventLogger.cs
- DesignerVerb.cs
- ToolZone.cs
- OleDbConnection.cs
- Int32RectValueSerializer.cs
- sqlcontext.cs
- Int64AnimationBase.cs
- MyContact.cs
- HotCommands.cs
- odbcmetadatacollectionnames.cs
- SecureEnvironment.cs
- _TLSstream.cs
- EventLogReader.cs
- NamespaceListProperty.cs
- GridViewUpdatedEventArgs.cs
- InlineCollection.cs
- XmlUtil.cs
- ReplyChannelBinder.cs
- BCLDebug.cs
- SQLMoneyStorage.cs
- PageParserFilter.cs
- TextTreeInsertUndoUnit.cs
- DynamicILGenerator.cs
- CachedPathData.cs
- XamlTemplateSerializer.cs
- CultureTable.cs
- RowUpdatingEventArgs.cs
- ActivationWorker.cs
- DataObjectSettingDataEventArgs.cs
- SystemIPGlobalStatistics.cs
- MetadataPropertyCollection.cs
- ServiceObjectContainer.cs
- ServiceEndpoint.cs
- CheckBoxField.cs
- DependencyObjectPropertyDescriptor.cs
- DoubleUtil.cs
- GroupBox.cs
- CompiledRegexRunner.cs
- SerializationSectionGroup.cs
- ThreadExceptionEvent.cs
- UIElement.cs
- Animatable.cs
- TreeViewImageIndexConverter.cs
- WinInetCache.cs
- PrintDialogException.cs
- PermissionSetEnumerator.cs
- InternalRelationshipCollection.cs
- UpdatePanelTriggerCollection.cs
- _SafeNetHandles.cs
- FixedTextView.cs
- D3DImage.cs
- LinkArea.cs
- EntityProviderFactory.cs
- sitestring.cs
- XmlNodeList.cs
- WmlTextBoxAdapter.cs
- TagNameToTypeMapper.cs
- DrawingImage.cs
- AliasedExpr.cs
- UpdatePanelTriggerCollection.cs
- Point3DCollection.cs
- Span.cs
- HtmlInputReset.cs
- AssociatedControlConverter.cs
- DesignerSerializerAttribute.cs
- IconConverter.cs
- Overlapped.cs
- ProfileWorkflowElement.cs
- AspNetSynchronizationContext.cs
- ResolveNameEventArgs.cs
- DataGridViewTopRowAccessibleObject.cs
- XPathNodeInfoAtom.cs
- OleDbWrapper.cs
- TableRowGroup.cs
- ButtonChrome.cs
- SerializationSectionGroup.cs
- UrlMappingCollection.cs
- ListViewUpdateEventArgs.cs