Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / SizeChangedEventArgs.cs / 1 / SizeChangedEventArgs.cs
using System; namespace System.Windows { ////// The SizeChangedEventArgs class is used by SizeChangedEventHandler. /// This handler is used for ComputedWidthChanged and ComputedHeightChanged events /// on UIElement. /// public class SizeChangedEventArgs : RoutedEventArgs { ////// Initializes a new instance of the SizeChangedEventArgs class. /// /// /// The UIElement which has its size changed by layout engine/>. /// /// /// The SizeChangeInfo that is used by. /// internal SizeChangedEventArgs(UIElement element, SizeChangedInfo info) { if (info == null) { throw new ArgumentNullException("info"); } if (element == null) { throw new ArgumentNullException("element"); } _element = element; _previousSize = info.PreviousSize; if(info.WidthChanged) _bits |= _widthChangedBit; if(info.HeightChanged) _bits |= _heightChangedBit; } /// /// Read-only access to the previous Size /// public Size PreviousSize { get { return _previousSize; } } ////// Read-only access to the new Size /// public Size NewSize { get { return _element.RenderSize; } } ////// Read-only access to the flag indicating that Width component of the size changed. /// Note that due to double math /// effects, the it may be (previousSize.Width != newSize.Width) and widthChanged = true. /// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of /// the input parameters, but the overall scene is considered to be "the same" so no visible changes /// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid /// invalidation of layout if the dimension didn't change. /// public bool WidthChanged { get { return ((_bits & _widthChangedBit) != 0); } } ////// Read-only access to the flag indicating that Height component of the size changed. /// Note that due to double math /// effects, the it may be (previousSize.Height != newSize.Height) and heightChanged = true. /// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of /// the input parameters, but the overall scene is considered to be "the same" so no visible changes /// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid /// invalidation of layout if the dimension didn't change. /// public bool HeightChanged { get { return ((_bits & _heightChangedBit) != 0); } } private Size _previousSize; private UIElement _element; private byte _bits; private static byte _widthChangedBit = 0x1; private static byte _heightChangedBit = 0x2; ////// The mechanism used to call the type-specific handler on the /// target. /// /// /// The generic handler to call in a type-specific way. /// /// /// The target to call the handler on. /// ///protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { SizeChangedEventHandler handler = (SizeChangedEventHandler) genericHandler; handler(genericTarget, this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; namespace System.Windows { /// /// The SizeChangedEventArgs class is used by SizeChangedEventHandler. /// This handler is used for ComputedWidthChanged and ComputedHeightChanged events /// on UIElement. /// public class SizeChangedEventArgs : RoutedEventArgs { ////// Initializes a new instance of the SizeChangedEventArgs class. /// /// /// The UIElement which has its size changed by layout engine/>. /// /// /// The SizeChangeInfo that is used by. /// internal SizeChangedEventArgs(UIElement element, SizeChangedInfo info) { if (info == null) { throw new ArgumentNullException("info"); } if (element == null) { throw new ArgumentNullException("element"); } _element = element; _previousSize = info.PreviousSize; if(info.WidthChanged) _bits |= _widthChangedBit; if(info.HeightChanged) _bits |= _heightChangedBit; } /// /// Read-only access to the previous Size /// public Size PreviousSize { get { return _previousSize; } } ////// Read-only access to the new Size /// public Size NewSize { get { return _element.RenderSize; } } ////// Read-only access to the flag indicating that Width component of the size changed. /// Note that due to double math /// effects, the it may be (previousSize.Width != newSize.Width) and widthChanged = true. /// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of /// the input parameters, but the overall scene is considered to be "the same" so no visible changes /// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid /// invalidation of layout if the dimension didn't change. /// public bool WidthChanged { get { return ((_bits & _widthChangedBit) != 0); } } ////// Read-only access to the flag indicating that Height component of the size changed. /// Note that due to double math /// effects, the it may be (previousSize.Height != newSize.Height) and heightChanged = true. /// This may happen in layout when sizes of objects are fluctuating because of a precision "jitter" of /// the input parameters, but the overall scene is considered to be "the same" so no visible changes /// will be detected. Typically, the handler of SizeChangedEvent should check this bit to avoid /// invalidation of layout if the dimension didn't change. /// public bool HeightChanged { get { return ((_bits & _heightChangedBit) != 0); } } private Size _previousSize; private UIElement _element; private byte _bits; private static byte _widthChangedBit = 0x1; private static byte _heightChangedBit = 0x2; ////// The mechanism used to call the type-specific handler on the /// target. /// /// /// The generic handler to call in a type-specific way. /// /// /// The target to call the handler on. /// ///protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { SizeChangedEventHandler handler = (SizeChangedEventHandler) genericHandler; handler(genericTarget, this); } } } // 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
- AbstractDataSvcMapFileLoader.cs
- Model3DCollection.cs
- EtwTrace.cs
- DebugControllerThread.cs
- StrongNameUtility.cs
- Helpers.cs
- CodeMemberMethod.cs
- FormViewDeletedEventArgs.cs
- RenderOptions.cs
- VectorAnimation.cs
- ToolstripProfessionalRenderer.cs
- ReflectionPermission.cs
- HostUtils.cs
- TextMarkerSource.cs
- WebPartEditVerb.cs
- MaskPropertyEditor.cs
- ListBindableAttribute.cs
- IisTraceListener.cs
- URL.cs
- ModelItemDictionary.cs
- TextStore.cs
- _Rfc2616CacheValidators.cs
- SiteMapDesignerDataSourceView.cs
- NumericPagerField.cs
- NetPipeSection.cs
- TextFormatterHost.cs
- CustomLineCap.cs
- documentsequencetextcontainer.cs
- TreeViewItemAutomationPeer.cs
- QuadraticBezierSegment.cs
- HttpContextBase.cs
- ToolStripRendererSwitcher.cs
- ConfigUtil.cs
- DesignTimeTemplateParser.cs
- ToolStripTextBox.cs
- InvokeSchedule.cs
- EntityProxyFactory.cs
- HtmlTableRowCollection.cs
- Tile.cs
- ScriptServiceAttribute.cs
- Effect.cs
- DataGridAutomationPeer.cs
- Exceptions.cs
- X509PeerCertificateAuthentication.cs
- ConfigurationPropertyAttribute.cs
- WebEventCodes.cs
- WinHttpWebProxyFinder.cs
- ObjectDataProvider.cs
- EncryptedType.cs
- SqlDataAdapter.cs
- streamingZipPartStream.cs
- WorkflowInstanceProvider.cs
- PersonalizationAdministration.cs
- PointF.cs
- DATA_BLOB.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- X509Utils.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- StsCommunicationException.cs
- CachedPathData.cs
- FusionWrap.cs
- MethodResolver.cs
- AxHost.cs
- SubpageParaClient.cs
- SqlCommandAsyncResult.cs
- Span.cs
- NameNode.cs
- StrongName.cs
- GridViewCancelEditEventArgs.cs
- ModifierKeysValueSerializer.cs
- Dynamic.cs
- SqlUserDefinedTypeAttribute.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- NoPersistProperty.cs
- ToolStripSeparator.cs
- Page.cs
- SimpleTypeResolver.cs
- Comparer.cs
- SoapFormatterSinks.cs
- AmbientLight.cs
- BulletChrome.cs
- CatalogPartChrome.cs
- PortCache.cs
- SqlConnectionFactory.cs
- ContextQuery.cs
- SerializationObjectManager.cs
- PackageStore.cs
- SecurityTokenSerializer.cs
- MenuItemAutomationPeer.cs
- SecurityResources.cs
- PlainXmlSerializer.cs
- IndexOutOfRangeException.cs
- JavaScriptString.cs
- UIElement.cs
- SqlBulkCopyColumnMapping.cs
- KeyInfo.cs
- VisualBasicSettingsHandler.cs
- PackageDigitalSignature.cs
- ThemeableAttribute.cs
- Win32MouseDevice.cs