Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / InheritanceUI.cs / 1 / InheritanceUI.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; ////// This class handles the user interface for inherited components. /// internal class InheritanceUI { private static Bitmap inheritanceGlyph; private static Rectangle inheritanceGlyphRect; private ToolTip tooltip; ////// The bitmap we use to show inheritance. /// public Bitmap InheritanceGlyph { get { if (inheritanceGlyph == null) { inheritanceGlyph = new Bitmap(typeof(InheritanceUI), "InheritedGlyph.bmp"); inheritanceGlyph.MakeTransparent(); } return inheritanceGlyph; } } ////// The rectangle surrounding the glyph. /// public Rectangle InheritanceGlyphRectangle { get { if (inheritanceGlyphRect == Rectangle.Empty) { Size size = InheritanceGlyph.Size; inheritanceGlyphRect = new Rectangle(0, 0, size.Width, size.Height); } return inheritanceGlyphRect; } } ////// Adds an inherited control to our list. This creates a tool tip for that /// control. /// public void AddInheritedControl(Control c, InheritanceLevel level) { if (tooltip == null) { tooltip = new ToolTip(); tooltip.ShowAlways = true; } Debug.Assert(level != InheritanceLevel.NotInherited, "This should only be called for inherited components."); string text; if (level == InheritanceLevel.InheritedReadOnly) { text = SR.GetString(SR.DesignerInheritedReadOnly); } else { text = SR.GetString(SR.DesignerInherited); } tooltip.SetToolTip(c, text); // Also, set all of its non-sited children foreach(Control child in c.Controls) { if (child.Site == null) { tooltip.SetToolTip(child, text); } } } public void Dispose() { if (tooltip != null) { tooltip.Dispose(); } } ////// Removes a previously added inherited control. /// public void RemoveInheritedControl(Control c) { if (tooltip != null && tooltip.GetToolTip(c).Length > 0) { tooltip.SetToolTip(c, null); // Also, set all of its non-sited children foreach(Control child in c.Controls) { if (child.Site == null) { tooltip.SetToolTip(child, null); } } } } } } // 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
- MimePart.cs
- ToolStripDesignerAvailabilityAttribute.cs
- Argument.cs
- Barrier.cs
- InternalTransaction.cs
- AsymmetricKeyExchangeFormatter.cs
- ConfigViewGenerator.cs
- CompilerLocalReference.cs
- StoreItemCollection.cs
- X509ScopedServiceCertificateElement.cs
- WorkflowOperationBehavior.cs
- TextTreeInsertElementUndoUnit.cs
- PageSettings.cs
- URL.cs
- TextDecorationUnitValidation.cs
- JournalEntry.cs
- SystemGatewayIPAddressInformation.cs
- ComboBox.cs
- TableStyle.cs
- SafeFindHandle.cs
- DependencyPropertyAttribute.cs
- BindingExpression.cs
- SmiMetaData.cs
- XPathScanner.cs
- MenuItem.cs
- DocumentGridPage.cs
- ListItemCollection.cs
- MemberPathMap.cs
- FixedHyperLink.cs
- DataControlImageButton.cs
- Timeline.cs
- Collection.cs
- MILUtilities.cs
- PageFunction.cs
- ResourceBinder.cs
- ConfigXmlReader.cs
- CounterSample.cs
- TcpHostedTransportConfiguration.cs
- ExceptionUtil.cs
- StatusBarDesigner.cs
- Section.cs
- NativeRightsManagementAPIsStructures.cs
- FixUpCollection.cs
- ImportException.cs
- TabPage.cs
- DataGridViewAddColumnDialog.cs
- RangeValidator.cs
- _DigestClient.cs
- PointAnimationBase.cs
- NopReturnReader.cs
- SetterBaseCollection.cs
- XmlTextAttribute.cs
- ReadContentAsBinaryHelper.cs
- DetailsViewInsertedEventArgs.cs
- TimeStampChecker.cs
- InkCanvasSelection.cs
- ConfigXmlSignificantWhitespace.cs
- ApplicationSecurityInfo.cs
- XmlHierarchicalDataSourceView.cs
- LabelLiteral.cs
- PipeConnection.cs
- AspCompat.cs
- ProtocolState.cs
- ComplexType.cs
- XappLauncher.cs
- TypeValidationEventArgs.cs
- _BufferOffsetSize.cs
- Documentation.cs
- ColumnWidthChangingEvent.cs
- cookiecollection.cs
- GeneralTransform.cs
- SystemColors.cs
- CellPartitioner.cs
- RuleSettings.cs
- BrowserCapabilitiesFactoryBase.cs
- DialogResultConverter.cs
- FixUpCollection.cs
- Margins.cs
- AudioStateChangedEventArgs.cs
- Merger.cs
- OperatingSystem.cs
- ByteStorage.cs
- AssociatedControlConverter.cs
- ValidationError.cs
- ResourceDescriptionAttribute.cs
- AppSecurityManager.cs
- DataGridViewCell.cs
- AppLevelCompilationSectionCache.cs
- Int16.cs
- PropertyTab.cs
- DrawingContextDrawingContextWalker.cs
- ScriptResourceDefinition.cs
- _DomainName.cs
- MaskInputRejectedEventArgs.cs
- SQLBinaryStorage.cs
- TextRangeEditTables.cs
- ToolStripButton.cs
- QueryParameter.cs
- ImportCatalogPart.cs
- PersistenceTypeAttribute.cs