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
- XsdCachingReader.cs
- PlatformCulture.cs
- ComponentResourceManager.cs
- RepeaterItem.cs
- MarkupWriter.cs
- Package.cs
- OutputCacheSection.cs
- ConnectionManagementElement.cs
- WebServiceMethodData.cs
- listitem.cs
- XslVisitor.cs
- FlowDocumentReaderAutomationPeer.cs
- ProfileEventArgs.cs
- DefaultEvaluationContext.cs
- ReadOnlyDictionary.cs
- Selection.cs
- odbcmetadatacolumnnames.cs
- Encoder.cs
- ServiceDescriptions.cs
- ResourceContainer.cs
- HtmlEncodedRawTextWriter.cs
- LinkButton.cs
- SoapAttributes.cs
- HtmlFormWrapper.cs
- CatalogZoneBase.cs
- Vector3DCollectionValueSerializer.cs
- SAPIEngineTypes.cs
- CleanUpVirtualizedItemEventArgs.cs
- DataServiceExpressionVisitor.cs
- AuthenticationSection.cs
- ModifierKeysValueSerializer.cs
- DataKey.cs
- SoundPlayerAction.cs
- SchemaImporter.cs
- ColorAnimationUsingKeyFrames.cs
- SmiContext.cs
- QuadraticBezierSegment.cs
- WebColorConverter.cs
- StreamDocument.cs
- TemplateColumn.cs
- SByteStorage.cs
- EntityContainerEmitter.cs
- XComponentModel.cs
- Line.cs
- TimerEventSubscription.cs
- ContextStaticAttribute.cs
- VSWCFServiceContractGenerator.cs
- DeclarativeCatalogPart.cs
- Lease.cs
- FlowDocumentPageViewerAutomationPeer.cs
- RegistrySecurity.cs
- XmlRootAttribute.cs
- ImplicitInputBrush.cs
- MachineKeyConverter.cs
- ApplicationActivator.cs
- UInt64Storage.cs
- PrintingPermissionAttribute.cs
- DaylightTime.cs
- storepermission.cs
- DataBoundControl.cs
- ServiceBehaviorElementCollection.cs
- CodeObject.cs
- ListManagerBindingsCollection.cs
- MultipleViewPattern.cs
- ObjectConverter.cs
- FreezableOperations.cs
- DataBoundControlHelper.cs
- StringInfo.cs
- QuaternionAnimation.cs
- ThicknessAnimationBase.cs
- URIFormatException.cs
- WorkflowInstanceExtensionManager.cs
- XmlSchemaExporter.cs
- RequestCachePolicyConverter.cs
- SqlStatistics.cs
- Track.cs
- SQLMembershipProvider.cs
- Tuple.cs
- DataSourceHelper.cs
- TdsParserStateObject.cs
- _NegotiateClient.cs
- TrustManagerMoreInformation.cs
- BindingGroup.cs
- UseAttributeSetsAction.cs
- XmlSchemaComplexType.cs
- LineGeometry.cs
- MsdtcClusterUtils.cs
- Convert.cs
- UntypedNullExpression.cs
- ActivityFunc.cs
- SoapAttributeOverrides.cs
- ToolStripPanelRow.cs
- MetadataArtifactLoaderComposite.cs
- RootBrowserWindow.cs
- ToolStripContentPanel.cs
- HandledEventArgs.cs
- ToolboxItemFilterAttribute.cs
- PassportPrincipal.cs
- TextTreeInsertElementUndoUnit.cs
- BamlLocalizerErrorNotifyEventArgs.cs