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
- XmlChildNodes.cs
- UIElementIsland.cs
- PerfService.cs
- RepeaterCommandEventArgs.cs
- AtomMaterializerLog.cs
- XmlUtil.cs
- GuidelineSet.cs
- MissingMemberException.cs
- NetStream.cs
- ControlIdConverter.cs
- Automation.cs
- Rotation3DAnimationUsingKeyFrames.cs
- UriTemplateTable.cs
- DatagridviewDisplayedBandsData.cs
- ListCommandEventArgs.cs
- DataGridSortCommandEventArgs.cs
- OutKeywords.cs
- TypeGeneratedEventArgs.cs
- ComboBoxRenderer.cs
- QueryOpeningEnumerator.cs
- CrossContextChannel.cs
- Crc32Helper.cs
- UpDownBase.cs
- MetadataArtifactLoader.cs
- XmlSchemaSearchPattern.cs
- unitconverter.cs
- UrlPropertyAttribute.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- SqlConnectionStringBuilder.cs
- WorkerRequest.cs
- Stream.cs
- DataGridViewCellConverter.cs
- AssociationSet.cs
- TextTabProperties.cs
- HtmlProps.cs
- Condition.cs
- TextStore.cs
- WebHttpBinding.cs
- WorkflowServiceAttributesTypeConverter.cs
- TaiwanCalendar.cs
- PropertyDescriptorComparer.cs
- KnownTypes.cs
- Variant.cs
- MdiWindowListItemConverter.cs
- JavaScriptObjectDeserializer.cs
- SectionXmlInfo.cs
- InvokeHandlers.cs
- SoapAttributeAttribute.cs
- StateRuntime.cs
- CodeTypeConstructor.cs
- EntityContainerEmitter.cs
- WCFBuildProvider.cs
- DispatcherExceptionFilterEventArgs.cs
- Timer.cs
- Byte.cs
- DefaultBindingPropertyAttribute.cs
- WebPartConnectionsCancelVerb.cs
- SessionStateItemCollection.cs
- FatalException.cs
- PointAnimationUsingPath.cs
- TextParagraphCache.cs
- AddressUtility.cs
- PolyLineSegment.cs
- UserPreferenceChangedEventArgs.cs
- CompositeScriptReferenceEventArgs.cs
- BooleanConverter.cs
- Light.cs
- FileClassifier.cs
- TreeNodeClickEventArgs.cs
- selecteditemcollection.cs
- AspNetSynchronizationContext.cs
- QilTernary.cs
- ConfigurationPermission.cs
- FixedSOMGroup.cs
- StyleSelector.cs
- ResourceDescriptionAttribute.cs
- WorkflowRuntimeService.cs
- SQLGuid.cs
- GridViewItemAutomationPeer.cs
- LocalizationParserHooks.cs
- ChildTable.cs
- ModifierKeysConverter.cs
- ReceiveDesigner.xaml.cs
- CatalogUtil.cs
- EmptyEnumerator.cs
- WsatServiceCertificate.cs
- PathSegment.cs
- webbrowsersite.cs
- SystemIcmpV4Statistics.cs
- Label.cs
- MsmqProcessProtocolHandler.cs
- PathGeometry.cs
- SystemMulticastIPAddressInformation.cs
- ScrollContentPresenter.cs
- HostExecutionContextManager.cs
- WebPartConnectionsCancelEventArgs.cs
- PageHandlerFactory.cs
- BaseDataBoundControl.cs
- DBParameter.cs
- CalendarItem.cs