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
- StorageMappingItemLoader.cs
- Token.cs
- WindowsComboBox.cs
- RegistrationProxy.cs
- ReaderWriterLock.cs
- ControlCachePolicy.cs
- VectorAnimationUsingKeyFrames.cs
- StatusBarItemAutomationPeer.cs
- HwndSourceKeyboardInputSite.cs
- RawStylusInput.cs
- WmfPlaceableFileHeader.cs
- TargetControlTypeAttribute.cs
- Source.cs
- TaiwanCalendar.cs
- SSmlParser.cs
- ServiceReference.cs
- BinaryParser.cs
- FontStyles.cs
- Permission.cs
- ComponentDispatcherThread.cs
- ExtensionWindowResizeGrip.cs
- OleDbCommand.cs
- CodePageEncoding.cs
- Point.cs
- XmlSchemaComplexType.cs
- WpfGeneratedKnownTypes.cs
- CardSpaceSelector.cs
- MethodCallTranslator.cs
- ContentDesigner.cs
- TriggerBase.cs
- SchemaTableOptionalColumn.cs
- GraphicsContext.cs
- sqlinternaltransaction.cs
- ValidationRuleCollection.cs
- ReceiveMessageRecord.cs
- SelectedCellsCollection.cs
- PeerEndPoint.cs
- DataKeyCollection.cs
- SafeEventHandle.cs
- ProfilePropertySettingsCollection.cs
- StickyNoteHelper.cs
- AbandonedMutexException.cs
- ParameterModifier.cs
- DecoderBestFitFallback.cs
- NetPipeSectionData.cs
- WindowInteractionStateTracker.cs
- RijndaelManagedTransform.cs
- DetailsViewInsertedEventArgs.cs
- FragmentQueryKB.cs
- DesignerTransactionCloseEvent.cs
- DoubleCollection.cs
- SwitchElementsCollection.cs
- TailPinnedEventArgs.cs
- DataListCommandEventArgs.cs
- HTTPAPI_VERSION.cs
- ObjRef.cs
- HtmlInputImage.cs
- DiscoveryOperationContextExtension.cs
- ColumnWidthChangingEvent.cs
- ImageBrush.cs
- OdbcFactory.cs
- OdbcParameterCollection.cs
- ManagementObject.cs
- ToolStripSeparator.cs
- DataProtection.cs
- DataGridViewCellCollection.cs
- Stack.cs
- DataGridItemCollection.cs
- RadioButtonAutomationPeer.cs
- XPathNodeInfoAtom.cs
- PageOutputQuality.cs
- GPRECT.cs
- CompilerGlobalScopeAttribute.cs
- PropertyEmitterBase.cs
- ResourceDescriptionAttribute.cs
- UserInitiatedNavigationPermission.cs
- HttpResponse.cs
- Propagator.Evaluator.cs
- XmlSchemaGroupRef.cs
- Parallel.cs
- TreeViewCancelEvent.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TextSchema.cs
- Quad.cs
- TextDecorationLocationValidation.cs
- KnownTypeAttribute.cs
- Int64AnimationUsingKeyFrames.cs
- ProviderIncompatibleException.cs
- StoreItemCollection.cs
- DeflateEmulationStream.cs
- StretchValidation.cs
- FixedSOMSemanticBox.cs
- XmlSchemaObjectTable.cs
- DnsPermission.cs
- localization.cs
- MeasurementDCInfo.cs
- DataGridViewColumnConverter.cs
- TreeNodeEventArgs.cs
- BamlRecordWriter.cs
- TextBoxBase.cs