Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DesignerToolStripControlHost.cs / 1 / DesignerToolStripControlHost.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System.Design; using Accessibility; using System.ComponentModel; using System.Diagnostics; using System; using System.Security; using System.Security.Permissions; using System.ComponentModel.Design; using System.Windows.Forms; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms.Design.Behavior; ////// /// This internal class is used by the new ToolStripDesigner to add a dummy /// node to the end. This class inherits from WinBarControlHost and overrides the /// CanSelect property so that the dummy Node when shown in the designer doesnt show /// selection on Mouse movements. /// The image is set to theDummyNodeImage embedded into the resources. /// ///internal class DesignerToolStripControlHost : ToolStripControlHost, IComponent { private BehaviorService b; internal ToolStrip parent=null; // // Constructor // /// public DesignerToolStripControlHost(Control c) : base(c) { // this ToolStripItem should not have defaultPadding. this.Margin = Padding.Empty; } /// /// /// We need to return Default size for Editor ToolStrip (92, 22). /// protected override Size DefaultSize { get { return new Size(92, 22); } } internal GlyphCollection GetGlyphs(ToolStrip parent, GlyphCollection glyphs, System.Windows.Forms.Design.Behavior.Behavior standardBehavior) { if (b == null) { b = (BehaviorService)parent.Site.GetService(typeof(BehaviorService)); } Point loc = b.ControlToAdornerWindow(this.Parent); Rectangle r = this.Bounds; r.Offset(loc); r.Inflate (-2 , -2); glyphs.Add(new MiniLockedBorderGlyph(r, SelectionBorderGlyphType.Top, standardBehavior, true)); glyphs.Add(new MiniLockedBorderGlyph(r, SelectionBorderGlyphType.Bottom, standardBehavior, true)); glyphs.Add(new MiniLockedBorderGlyph(r, SelectionBorderGlyphType.Left, standardBehavior, true)); glyphs.Add(new MiniLockedBorderGlyph(r, SelectionBorderGlyphType.Right, standardBehavior, true)); return glyphs; } internal void RefreshSelectionGlyph() { ToolStrip miniToolStrip = this.Control as ToolStrip; if (miniToolStrip != null) { ToolStripTemplateNode.MiniToolStripRenderer renderer = miniToolStrip.Renderer as ToolStripTemplateNode.MiniToolStripRenderer; if (renderer != null) { renderer.State = (int)TemplateNodeSelectionState.None; miniToolStrip.Invalidate(); } } } internal void SelectControl() { ToolStrip miniToolStrip = this.Control as ToolStrip; if (miniToolStrip != null) { ToolStripTemplateNode.MiniToolStripRenderer renderer = miniToolStrip.Renderer as ToolStripTemplateNode.MiniToolStripRenderer; if (renderer != null) { renderer.State = (int)TemplateNodeSelectionState.TemplateNodeSelected; miniToolStrip.Invalidate(); } } } } } // 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
- BufferBuilder.cs
- Cursors.cs
- DataGridViewImageCell.cs
- EdmItemCollection.cs
- DateTimeValueSerializerContext.cs
- DbProviderManifest.cs
- Style.cs
- ElementsClipboardData.cs
- EventHandlersStore.cs
- Soap12ProtocolReflector.cs
- XsltLibrary.cs
- ScopedKnownTypes.cs
- XmlSerializableReader.cs
- NetDispatcherFaultException.cs
- FileDialogCustomPlace.cs
- XmlTypeMapping.cs
- PartialList.cs
- DataServiceHostWrapper.cs
- BaseAsyncResult.cs
- ColumnWidthChangedEvent.cs
- ListViewCancelEventArgs.cs
- TemplateDefinition.cs
- DropSource.cs
- SizeChangedInfo.cs
- MultiBinding.cs
- GregorianCalendarHelper.cs
- WindowsFormsHelpers.cs
- MappingSource.cs
- FileDialogCustomPlacesCollection.cs
- RoutedPropertyChangedEventArgs.cs
- ProfileSettings.cs
- ResolveNameEventArgs.cs
- SqlNodeAnnotations.cs
- CharacterHit.cs
- ToolStripDropTargetManager.cs
- DataTableCollection.cs
- SqlMethodAttribute.cs
- C14NUtil.cs
- TableCellCollection.cs
- OpenFileDialog.cs
- FontCacheUtil.cs
- DateTimeOffsetStorage.cs
- SelectionPattern.cs
- Int32CollectionConverter.cs
- PriorityItem.cs
- NonVisualControlAttribute.cs
- ConvertEvent.cs
- CodeGeneratorAttribute.cs
- UInt32.cs
- RenamedEventArgs.cs
- ButtonStandardAdapter.cs
- MetadataArtifactLoaderFile.cs
- IPHostEntry.cs
- RemoteWebConfigurationHostStream.cs
- DispatcherSynchronizationContext.cs
- ComponentResourceKeyConverter.cs
- datacache.cs
- ControlType.cs
- ExceptQueryOperator.cs
- ProxyWebPart.cs
- WaitHandleCannotBeOpenedException.cs
- TemplateXamlParser.cs
- RuntimeCompatibilityAttribute.cs
- SqlPersonalizationProvider.cs
- externdll.cs
- BitmapMetadataEnumerator.cs
- MemberHolder.cs
- IntPtr.cs
- EffectiveValueEntry.cs
- FeatureSupport.cs
- BitSet.cs
- BuildProvider.cs
- BuiltInExpr.cs
- LocalizableAttribute.cs
- CodeStatement.cs
- ResXResourceSet.cs
- XmlSerializationReader.cs
- PermissionSet.cs
- PersistenceProviderElement.cs
- Rect3D.cs
- ArrayTypeMismatchException.cs
- TypeInfo.cs
- ListViewTableCell.cs
- TreeIterators.cs
- diagnosticsswitches.cs
- XomlCompilerParameters.cs
- HttpWebRequest.cs
- WebPartDescription.cs
- DefaultValueAttribute.cs
- IsolatedStorageFilePermission.cs
- EntitySqlQueryCacheEntry.cs
- DesignerEventService.cs
- TableLayoutPanel.cs
- RectAnimation.cs
- IsolatedStorageFileStream.cs
- PackageRelationshipCollection.cs
- UpdatePanelTriggerCollection.cs
- EpmAttributeNameBuilder.cs
- ToolStripSeparator.cs
- PauseStoryboard.cs