Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / ToolStripOverflowButton.cs / 1 / ToolStripOverflowButton.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Diagnostics; using System.Windows.Forms.Design; ////// /// ToolStripOverflowButton /// [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.None)] public class ToolStripOverflowButton : ToolStripDropDownButton { // we need to cache this away as the Parent property gets reset a lot. private ToolStrip parentToolStrip; ///[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] internal ToolStripOverflowButton(ToolStrip parentToolStrip) { SupportsItemClick = false; this.parentToolStrip = parentToolStrip; } /// protected internal override Padding DefaultMargin { get { return Padding.Empty; } } /// public override bool HasDropDownItems { get { return this.ParentInternal.OverflowItems.Count > 0; } } internal override bool OppositeDropDownAlign { get { return true; } } internal ToolStrip ParentToolStrip { get { return parentToolStrip; } } [ Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] public new bool RightToLeftAutoMirrorImage { get { return base.RightToLeftAutoMirrorImage; } set { base.RightToLeftAutoMirrorImage = value; } } protected override AccessibleObject CreateAccessibilityInstance() { return new ToolStripOverflowButtonAccessibleObject(this); } /// protected override ToolStripDropDown CreateDefaultDropDown() { // AutoGenerate a Winbar DropDown - set the property so we hook events return new ToolStripOverflow(this); } /// public override Size GetPreferredSize(Size constrainingSize) { Size preferredSize = constrainingSize; if (this.ParentInternal != null) { if (this.ParentInternal.Orientation == Orientation.Horizontal) { preferredSize.Width = Math.Min(constrainingSize.Width, 16); } else { preferredSize.Height = Math.Min(constrainingSize.Height, 16); } } return preferredSize + this.Padding.Size; } // make sure the Overflow button extends from edge-edge. (Ignore Padding/Margin). internal protected override void SetBounds(Rectangle bounds) { if (ParentInternal != null && ParentInternal.LayoutEngine is ToolStripSplitStackLayout) { if (ParentInternal.Orientation == Orientation.Horizontal) { bounds.Height = ParentInternal.Height; bounds.Y = 0; } else { bounds.Width = ParentInternal.Width; bounds.X = 0; } } base.SetBounds(bounds); } /// protected override void OnPaint(PaintEventArgs e) { if (this.ParentInternal != null) { ToolStripRenderer renderer = this.ParentInternal.Renderer; renderer.DrawOverflowButtonBackground(new ToolStripItemRenderEventArgs(e.Graphics, this)); } } internal class ToolStripOverflowButtonAccessibleObject : ToolStripDropDownItemAccessibleObject { private string stockName; public ToolStripOverflowButtonAccessibleObject(ToolStripOverflowButton owner) : base(owner){ } public override string Name { get { string name = Owner.AccessibleName; if (name != null) { return name; } if (string.IsNullOrEmpty(stockName)) { stockName = SR.GetString(SR.ToolStripOptions); } return stockName; } set { base.Name = value; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Diagnostics; using System.Windows.Forms.Design; ////// /// ToolStripOverflowButton /// [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.None)] public class ToolStripOverflowButton : ToolStripDropDownButton { // we need to cache this away as the Parent property gets reset a lot. private ToolStrip parentToolStrip; ///[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] internal ToolStripOverflowButton(ToolStrip parentToolStrip) { SupportsItemClick = false; this.parentToolStrip = parentToolStrip; } /// protected internal override Padding DefaultMargin { get { return Padding.Empty; } } /// public override bool HasDropDownItems { get { return this.ParentInternal.OverflowItems.Count > 0; } } internal override bool OppositeDropDownAlign { get { return true; } } internal ToolStrip ParentToolStrip { get { return parentToolStrip; } } [ Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] public new bool RightToLeftAutoMirrorImage { get { return base.RightToLeftAutoMirrorImage; } set { base.RightToLeftAutoMirrorImage = value; } } protected override AccessibleObject CreateAccessibilityInstance() { return new ToolStripOverflowButtonAccessibleObject(this); } /// protected override ToolStripDropDown CreateDefaultDropDown() { // AutoGenerate a Winbar DropDown - set the property so we hook events return new ToolStripOverflow(this); } /// public override Size GetPreferredSize(Size constrainingSize) { Size preferredSize = constrainingSize; if (this.ParentInternal != null) { if (this.ParentInternal.Orientation == Orientation.Horizontal) { preferredSize.Width = Math.Min(constrainingSize.Width, 16); } else { preferredSize.Height = Math.Min(constrainingSize.Height, 16); } } return preferredSize + this.Padding.Size; } // make sure the Overflow button extends from edge-edge. (Ignore Padding/Margin). internal protected override void SetBounds(Rectangle bounds) { if (ParentInternal != null && ParentInternal.LayoutEngine is ToolStripSplitStackLayout) { if (ParentInternal.Orientation == Orientation.Horizontal) { bounds.Height = ParentInternal.Height; bounds.Y = 0; } else { bounds.Width = ParentInternal.Width; bounds.X = 0; } } base.SetBounds(bounds); } /// protected override void OnPaint(PaintEventArgs e) { if (this.ParentInternal != null) { ToolStripRenderer renderer = this.ParentInternal.Renderer; renderer.DrawOverflowButtonBackground(new ToolStripItemRenderEventArgs(e.Graphics, this)); } } internal class ToolStripOverflowButtonAccessibleObject : ToolStripDropDownItemAccessibleObject { private string stockName; public ToolStripOverflowButtonAccessibleObject(ToolStripOverflowButton owner) : base(owner){ } public override string Name { get { string name = Owner.AccessibleName; if (name != null) { return name; } if (string.IsNullOrEmpty(stockName)) { stockName = SR.GetString(SR.ToolStripOptions); } return stockName; } set { base.Name = value; } } } } } // 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
- TransformerConfigurationWizardBase.cs
- ProtocolsSection.cs
- ToolStripItemCollection.cs
- WebControlAdapter.cs
- ConstantProjectedSlot.cs
- CaseInsensitiveHashCodeProvider.cs
- InheritanceService.cs
- WmiInstallComponent.cs
- Dispatcher.cs
- ContextProperty.cs
- _ConnectionGroup.cs
- FixedSOMImage.cs
- NamedPermissionSet.cs
- SecurityDocument.cs
- PerformanceCounterPermissionEntryCollection.cs
- LayoutTable.cs
- Condition.cs
- ProtocolImporter.cs
- MatrixKeyFrameCollection.cs
- NavigationCommands.cs
- DataFormats.cs
- SvcMapFileLoader.cs
- LayoutManager.cs
- KerberosRequestorSecurityToken.cs
- SafeSecurityHelper.cs
- QilFactory.cs
- QuadraticEase.cs
- Compiler.cs
- CryptoStream.cs
- MultilineStringConverter.cs
- EpmContentSerializerBase.cs
- ToolbarAUtomationPeer.cs
- SQLBytesStorage.cs
- ThousandthOfEmRealDoubles.cs
- Parameter.cs
- DiscoveryClientReferences.cs
- EdmSchemaAttribute.cs
- adornercollection.cs
- CheckBoxStandardAdapter.cs
- SmiMetaData.cs
- ProcessHostFactoryHelper.cs
- MethodImplAttribute.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- DatagridviewDisplayedBandsData.cs
- UriTemplateMatch.cs
- ScopedKnownTypes.cs
- BufferBuilder.cs
- ListViewCancelEventArgs.cs
- SliderAutomationPeer.cs
- SemanticResolver.cs
- QueryPageSettingsEventArgs.cs
- ProtocolsConfigurationHandler.cs
- IdleTimeoutMonitor.cs
- CodeDirectoryCompiler.cs
- SharedDp.cs
- CustomBindingElementCollection.cs
- Geometry3D.cs
- HtmlElementCollection.cs
- ViewStateModeByIdAttribute.cs
- OleDbConnectionFactory.cs
- CodeTypeReference.cs
- WebPartCatalogAddVerb.cs
- EdmFunctions.cs
- invalidudtexception.cs
- TextEffect.cs
- SpeakInfo.cs
- XmlFormatReaderGenerator.cs
- Roles.cs
- X509ChainPolicy.cs
- WebPartMinimizeVerb.cs
- PresentationTraceSources.cs
- SamlAudienceRestrictionCondition.cs
- webeventbuffer.cs
- ScriptReferenceBase.cs
- autovalidator.cs
- HeaderCollection.cs
- ScopedKnownTypes.cs
- FormClosedEvent.cs
- CategoriesDocument.cs
- WebPartZoneBase.cs
- DocumentViewerBase.cs
- OdbcDataAdapter.cs
- CodeTypeReferenceExpression.cs
- XmlSchemaSimpleType.cs
- messageonlyhwndwrapper.cs
- FloaterParaClient.cs
- GridItemPattern.cs
- MouseGestureConverter.cs
- TreeNodeBinding.cs
- Int32Converter.cs
- log.cs
- TransformedBitmap.cs
- DbDataReader.cs
- AppDomainInfo.cs
- Point3DConverter.cs
- LeftCellWrapper.cs
- listviewsubitemcollectioneditor.cs
- OutputCacheSection.cs
- SoapClientMessage.cs
- SignedXmlDebugLog.cs