Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Design / Util / HeaderPanel.cs / 1305376 / HeaderPanel.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.MobileControls.Util { using System; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; [ System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode) ] [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class HeaderPanel : Panel { private int _recursionCount = 0; internal void RequestNewHeight(HeaderLabel header, int height) { int offset = height - header.Height; try { // This is a workaround for a RTB issue that causes their // algorithm to ---- up if OnContentsResize recurses. (Now // that HeaderLabel does not resize the text untill after // autoscaling, we do not seem to hit this, but just in case). // // On the first call the RTB guesses its best dimensions // for the given text. We correct the Width which may cause // a second recursive call to adjust the height. if(_recursionCount < 2) { _recursionCount++; header.Height = height; // foreach(Control child in Controls) { if(child.Top > header.Top) { child.Top += offset; } } for( Control controlIterator = this; controlIterator != null; controlIterator = controlIterator.Parent ) { controlIterator.Height += offset; } } else { Debug.Assert(offset == 0, "On 3rd recursive call offset is not yet stabalized." ); } } finally { _recursionCount = 0; } } protected override void OnSizeChanged(EventArgs e) { foreach(Control child in Controls) { if(child is HeaderLabel) { child.Width = Width; } } base.OnSizeChanged(e); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.MobileControls.Util { using System; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; [ System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode) ] [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class HeaderPanel : Panel { private int _recursionCount = 0; internal void RequestNewHeight(HeaderLabel header, int height) { int offset = height - header.Height; try { // This is a workaround for a RTB issue that causes their // algorithm to ---- up if OnContentsResize recurses. (Now // that HeaderLabel does not resize the text untill after // autoscaling, we do not seem to hit this, but just in case). // // On the first call the RTB guesses its best dimensions // for the given text. We correct the Width which may cause // a second recursive call to adjust the height. if(_recursionCount < 2) { _recursionCount++; header.Height = height; // foreach(Control child in Controls) { if(child.Top > header.Top) { child.Top += offset; } } for( Control controlIterator = this; controlIterator != null; controlIterator = controlIterator.Parent ) { controlIterator.Height += offset; } } else { Debug.Assert(offset == 0, "On 3rd recursive call offset is not yet stabalized." ); } } finally { _recursionCount = 0; } } protected override void OnSizeChanged(EventArgs e) { foreach(Control child in Controls) { if(child is HeaderLabel) { child.Width = Width; } } base.OnSizeChanged(e); } } } // 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
- NullRuntimeConfig.cs
- _ScatterGatherBuffers.cs
- SettingsPropertyCollection.cs
- TextTrailingCharacterEllipsis.cs
- TagPrefixInfo.cs
- DuplicateWaitObjectException.cs
- AlgoModule.cs
- ClockGroup.cs
- RelatedImageListAttribute.cs
- ValueTypeFixupInfo.cs
- XmlTextAttribute.cs
- ColumnHeaderCollectionEditor.cs
- EndPoint.cs
- ContentElement.cs
- PersistenceTypeAttribute.cs
- ClientSettingsProvider.cs
- Compiler.cs
- Opcode.cs
- RequestCacheValidator.cs
- ColorConvertedBitmapExtension.cs
- InnerItemCollectionView.cs
- PropertyKey.cs
- LinearGradientBrush.cs
- SiteMapNodeItemEventArgs.cs
- TreeNodeStyle.cs
- EntityTypeEmitter.cs
- RectAnimationBase.cs
- DeflateStreamAsyncResult.cs
- Model3DGroup.cs
- FixedSOMElement.cs
- FrameAutomationPeer.cs
- ApplicationFileCodeDomTreeGenerator.cs
- AspNetCacheProfileAttribute.cs
- AttributeProviderAttribute.cs
- ToolboxBitmapAttribute.cs
- HttpProtocolImporter.cs
- Form.cs
- Matrix.cs
- TreeNode.cs
- ConstraintStruct.cs
- StatusBarDesigner.cs
- ErrorWebPart.cs
- CustomSignedXml.cs
- CallTemplateAction.cs
- TagMapCollection.cs
- ProxyWebPart.cs
- SettingsSavedEventArgs.cs
- ExpressionNode.cs
- FormViewModeEventArgs.cs
- CodePageEncoding.cs
- TransportElement.cs
- SystemTcpConnection.cs
- Dynamic.cs
- EntityAdapter.cs
- ObjectMaterializedEventArgs.cs
- JsonDeserializer.cs
- DataGridViewColumnCollectionEditor.cs
- SettingsBindableAttribute.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SizeValueSerializer.cs
- AssignDesigner.xaml.cs
- ScrollItemProviderWrapper.cs
- SimpleTypesSurrogate.cs
- RecognizerStateChangedEventArgs.cs
- CaseCqlBlock.cs
- WebPartTransformerCollection.cs
- OleDbDataReader.cs
- SafeRightsManagementHandle.cs
- DBDataPermissionAttribute.cs
- StaticContext.cs
- MetadataFile.cs
- Selector.cs
- StorageFunctionMapping.cs
- StringOutput.cs
- XpsLiterals.cs
- FlowDocumentPageViewerAutomationPeer.cs
- ObjectItemCollection.cs
- TextRangeEditLists.cs
- NativeCompoundFileAPIs.cs
- BamlReader.cs
- OleDbReferenceCollection.cs
- ReaderWriterLock.cs
- CLRBindingWorker.cs
- AudioSignalProblemOccurredEventArgs.cs
- PointKeyFrameCollection.cs
- MemberDescriptor.cs
- ImageMetadata.cs
- Compiler.cs
- Tokenizer.cs
- Rotation3D.cs
- ISAPIApplicationHost.cs
- ImageSource.cs
- ScrollContentPresenter.cs
- DataGridPagerStyle.cs
- RC2.cs
- TypeDescriptionProviderAttribute.cs
- Brush.cs
- DBCommand.cs
- PixelFormats.cs
- HttpCookie.cs