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
- XhtmlBasicValidatorAdapter.cs
- DPTypeDescriptorContext.cs
- BamlResourceDeserializer.cs
- Solver.cs
- Overlapped.cs
- LoadRetryAsyncResult.cs
- ResourceIDHelper.cs
- ComponentSerializationService.cs
- ErrorItem.cs
- HttpsChannelFactory.cs
- Brush.cs
- CodePropertyReferenceExpression.cs
- TableAutomationPeer.cs
- ProfileServiceManager.cs
- KnownBoxes.cs
- CLSCompliantAttribute.cs
- QueryTaskGroupState.cs
- GroupBoxRenderer.cs
- SqlDataSourceStatusEventArgs.cs
- TypeConverterHelper.cs
- GeneralTransformCollection.cs
- FileFormatException.cs
- BufferedReadStream.cs
- uribuilder.cs
- XmlILConstructAnalyzer.cs
- TraceRecords.cs
- PropertyGridEditorPart.cs
- Pens.cs
- NamedPipeChannelListener.cs
- SliderAutomationPeer.cs
- _UncName.cs
- XpsResourceDictionary.cs
- querybuilder.cs
- WindowInteropHelper.cs
- ListBox.cs
- LabelDesigner.cs
- DataColumnCollection.cs
- Separator.cs
- SessionParameter.cs
- CellQuery.cs
- TableCellCollection.cs
- IdnElement.cs
- PermissionListSet.cs
- AuthenticationSection.cs
- DbException.cs
- FormViewDeleteEventArgs.cs
- DataPager.cs
- Triplet.cs
- _UriTypeConverter.cs
- CryptoStream.cs
- XPathNavigator.cs
- StructuredTypeInfo.cs
- GridErrorDlg.cs
- HyperLinkDataBindingHandler.cs
- TableProvider.cs
- dataprotectionpermission.cs
- ResourceIDHelper.cs
- Pen.cs
- TabItemWrapperAutomationPeer.cs
- PkcsMisc.cs
- WorkflowTransactionService.cs
- ResourceIDHelper.cs
- CriticalHandle.cs
- BlockCollection.cs
- WorkflowElementDialog.cs
- ConfigXmlComment.cs
- ViewGenerator.cs
- ModuleElement.cs
- DesignerSerializationVisibilityAttribute.cs
- ResourceWriter.cs
- FormsAuthenticationUser.cs
- PieceDirectory.cs
- DataColumnCollection.cs
- CodeTypeParameter.cs
- _Connection.cs
- ProxyAttribute.cs
- BindingObserver.cs
- AssemblyBuilderData.cs
- WebPartDisplayMode.cs
- OutOfProcStateClientManager.cs
- DesignerActionList.cs
- NameHandler.cs
- DesignTimeVisibleAttribute.cs
- CodeAssignStatement.cs
- SqlInternalConnectionSmi.cs
- Transform3DCollection.cs
- CompositeFontInfo.cs
- SiteMapDataSource.cs
- DaylightTime.cs
- FigureParagraph.cs
- XsltInput.cs
- MultipleViewProviderWrapper.cs
- XPathAncestorIterator.cs
- LeftCellWrapper.cs
- SubMenuStyle.cs
- Int64AnimationBase.cs
- ListItem.cs
- ImageInfo.cs
- SqlIdentifier.cs
- Brushes.cs