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
- GrammarBuilder.cs
- RadialGradientBrush.cs
- ExecutedRoutedEventArgs.cs
- MimeAnyImporter.cs
- WindowsTab.cs
- CryptoConfig.cs
- FileVersionInfo.cs
- CodeExpressionCollection.cs
- SmtpReplyReader.cs
- OletxResourceManager.cs
- TextElementEnumerator.cs
- _Events.cs
- UserControlCodeDomTreeGenerator.cs
- ImageFormatConverter.cs
- XmlCustomFormatter.cs
- TdsEnums.cs
- HttpAsyncResult.cs
- LoadWorkflowByInstanceKeyCommand.cs
- ThreadExceptionEvent.cs
- XPathNavigator.cs
- RadioButtonRenderer.cs
- DataBoundLiteralControl.cs
- BigInt.cs
- _ConnectionGroup.cs
- Collection.cs
- WebPartCloseVerb.cs
- FrameSecurityDescriptor.cs
- RequestQueue.cs
- MimeParameters.cs
- MemoryStream.cs
- MarkupExtensionParser.cs
- UnsafeNativeMethodsTablet.cs
- ThemeableAttribute.cs
- PrePostDescendentsWalker.cs
- DataObject.cs
- TemplateField.cs
- ByteRangeDownloader.cs
- EventWaitHandleSecurity.cs
- LoaderAllocator.cs
- KernelTypeValidation.cs
- HttpPostedFile.cs
- WebPartConnectionsDisconnectVerb.cs
- TouchFrameEventArgs.cs
- safesecurityhelperavalon.cs
- MethodSet.cs
- DefaultCommandConverter.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- CodeMemberProperty.cs
- Pen.cs
- CompiledQueryCacheEntry.cs
- HandoffBehavior.cs
- InfoCard.cs
- ReadOnlyPropertyMetadata.cs
- PaintValueEventArgs.cs
- DataServiceSaveChangesEventArgs.cs
- XmlQueryOutput.cs
- WebPartHeaderCloseVerb.cs
- DropShadowBitmapEffect.cs
- ButtonChrome.cs
- FileNotFoundException.cs
- EntityContainerRelationshipSet.cs
- RoleManagerEventArgs.cs
- AspCompat.cs
- SimpleWebHandlerParser.cs
- AppSettingsExpressionBuilder.cs
- WpfKnownMember.cs
- TreeNodeSelectionProcessor.cs
- XamlPoint3DCollectionSerializer.cs
- DataKeyArray.cs
- BaseParser.cs
- EnumBuilder.cs
- Overlapped.cs
- SettingsBase.cs
- QueryExtender.cs
- CodeDelegateInvokeExpression.cs
- MemberAssignment.cs
- DBProviderConfigurationHandler.cs
- AssociatedControlConverter.cs
- PowerStatus.cs
- CompiledQueryCacheKey.cs
- CroppedBitmap.cs
- RoutedEventArgs.cs
- AutomationPattern.cs
- RankException.cs
- FrameworkTextComposition.cs
- ItemContainerGenerator.cs
- ProfileSettings.cs
- PropertyCollection.cs
- SQLBinaryStorage.cs
- ContentDisposition.cs
- AppDomainProtocolHandler.cs
- RegexMatch.cs
- VisualBasicExpressionConverter.cs
- RSAPKCS1SignatureDeformatter.cs
- VerticalAlignConverter.cs
- OracleEncoding.cs
- SymbolTable.cs
- XPathDescendantIterator.cs
- CultureTable.cs
- SortKey.cs