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
- Table.cs
- returneventsaver.cs
- ButtonPopupAdapter.cs
- FileSystemEventArgs.cs
- ComboBoxAutomationPeer.cs
- DeliveryStrategy.cs
- AccessibleObject.cs
- ReadOnlyObservableCollection.cs
- SystemInfo.cs
- InfoCardAsymmetricCrypto.cs
- PrimitiveRenderer.cs
- InputQueue.cs
- Select.cs
- HtmlInputSubmit.cs
- GreenMethods.cs
- ScriptResourceInfo.cs
- SingleAnimation.cs
- Rotation3D.cs
- GreenMethods.cs
- ContentPathSegment.cs
- ObjectConverter.cs
- ConfigurationManagerHelper.cs
- PropertyTab.cs
- JavaScriptObjectDeserializer.cs
- PropertyItemInternal.cs
- NetworkInformationException.cs
- Filter.cs
- Transform3DCollection.cs
- PropertyInformation.cs
- WebPartTransformerCollection.cs
- IsolatedStorageException.cs
- SystemIPv4InterfaceProperties.cs
- StrongName.cs
- WindowsFont.cs
- XmlWellformedWriter.cs
- ContentPlaceHolder.cs
- NameObjectCollectionBase.cs
- EllipseGeometry.cs
- XsltArgumentList.cs
- DataMisalignedException.cs
- XmlRootAttribute.cs
- Helpers.cs
- DbProviderFactories.cs
- ControlCodeDomSerializer.cs
- AlternationConverter.cs
- WebContentFormatHelper.cs
- Double.cs
- DataGridViewIntLinkedList.cs
- ProfileSettingsCollection.cs
- SerializationSectionGroup.cs
- GrammarBuilderPhrase.cs
- XmlAnyAttributeAttribute.cs
- DllHostedComPlusServiceHost.cs
- FixedPage.cs
- FigureHelper.cs
- AutomationElement.cs
- TemplatedAdorner.cs
- DesignConnection.cs
- ListControlDesigner.cs
- FixedSOMImage.cs
- DetailsViewRowCollection.cs
- SchemaEntity.cs
- DataPager.cs
- QueryCacheEntry.cs
- ColorKeyFrameCollection.cs
- AsyncOperation.cs
- CodeSnippetStatement.cs
- Button.cs
- FtpWebRequest.cs
- StopStoryboard.cs
- XamlStyleSerializer.cs
- ConnectionInterfaceCollection.cs
- WindowsAltTab.cs
- NotImplementedException.cs
- DbDataRecord.cs
- SizeAnimation.cs
- ChannelTraceRecord.cs
- FramingEncoders.cs
- DBSqlParserTable.cs
- DocumentNUp.cs
- SqlClientMetaDataCollectionNames.cs
- XmlILOptimizerVisitor.cs
- Underline.cs
- CodeGen.cs
- CodeComment.cs
- FormsAuthenticationEventArgs.cs
- OdbcDataAdapter.cs
- ServiceModelExtensionElement.cs
- ProvidersHelper.cs
- RoutedUICommand.cs
- ContentControl.cs
- TextEffect.cs
- mactripleDES.cs
- SqlTrackingService.cs
- StringReader.cs
- ArrayElementGridEntry.cs
- EntityDataSourceContextCreatingEventArgs.cs
- GridItemPatternIdentifiers.cs
- HttpSocketManager.cs
- RichTextBoxConstants.cs