Code:
/ DotNET / DotNET / 8.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
- CodeMemberEvent.cs
- X509Certificate2.cs
- DesignTimeHTMLTextWriter.cs
- InitializerFacet.cs
- GlyphRunDrawing.cs
- SqlOuterApplyReducer.cs
- ActivationServices.cs
- ModuleElement.cs
- DataGridViewButtonCell.cs
- CharEnumerator.cs
- CharEntityEncoderFallback.cs
- TextDecorationCollection.cs
- TextServicesCompartmentContext.cs
- WebPartConnectionsCancelVerb.cs
- TreeViewItem.cs
- WebPartHelpVerb.cs
- AuthenticationModuleElement.cs
- EditorServiceContext.cs
- XNodeNavigator.cs
- CompareValidator.cs
- ComboBoxAutomationPeer.cs
- AssertSection.cs
- PartialToken.cs
- BindingListCollectionView.cs
- EntityConnectionStringBuilder.cs
- uribuilder.cs
- GeneralTransform3DTo2D.cs
- InternalConfigRoot.cs
- PageCodeDomTreeGenerator.cs
- ImageBrush.cs
- DirectoryObjectSecurity.cs
- CodeCompiler.cs
- ListView.cs
- DataTableMappingCollection.cs
- SecurityUtils.cs
- XmlWrappingReader.cs
- Focus.cs
- TemplateBamlRecordReader.cs
- DataGridViewRow.cs
- WaitForChangedResult.cs
- StringStorage.cs
- WebRequestModuleElementCollection.cs
- InputScopeConverter.cs
- LocationSectionRecord.cs
- CommandConverter.cs
- LinkTarget.cs
- CommonDialog.cs
- TokenBasedSet.cs
- XAMLParseException.cs
- NullReferenceException.cs
- CodePropertyReferenceExpression.cs
- ScriptReferenceEventArgs.cs
- ResXFileRef.cs
- SolidColorBrush.cs
- ExpressionEvaluator.cs
- RegexReplacement.cs
- HtmlTableRowCollection.cs
- localization.cs
- ExceptionTranslationTable.cs
- AutomationTextAttribute.cs
- Ref.cs
- CachedBitmap.cs
- ResourceDefaultValueAttribute.cs
- DefinitionProperties.cs
- IPEndPoint.cs
- BuildManager.cs
- _ServiceNameStore.cs
- HttpCacheParams.cs
- Win32Interop.cs
- FullTextLine.cs
- SqlUnionizer.cs
- DataGridViewRowsAddedEventArgs.cs
- GeneralTransform3DCollection.cs
- XamlTemplateSerializer.cs
- MailHeaderInfo.cs
- DesignerSerializerAttribute.cs
- HebrewNumber.cs
- DataBoundLiteralControl.cs
- RC2CryptoServiceProvider.cs
- Events.cs
- COM2Properties.cs
- RoutedEvent.cs
- OdbcDataAdapter.cs
- errorpatternmatcher.cs
- sqlpipe.cs
- DbProviderManifest.cs
- XmlILConstructAnalyzer.cs
- FixedSOMTableCell.cs
- WindowsToolbarAsMenu.cs
- WebZoneDesigner.cs
- templategroup.cs
- CaretElement.cs
- ScrollViewer.cs
- StaticTextPointer.cs
- AttributeSetAction.cs
- Interfaces.cs
- StyleModeStack.cs
- ReadContentAsBinaryHelper.cs
- X500Name.cs
- PermissionListSet.cs