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
- AudioFormatConverter.cs
- CodeDesigner.cs
- MaskedTextBoxDesignerActionList.cs
- ReadContentAsBinaryHelper.cs
- TextElementEnumerator.cs
- DecoderFallback.cs
- StrongNameKeyPair.cs
- DesignerUtility.cs
- XmlSubtreeReader.cs
- AdditionalEntityFunctions.cs
- CryptoApi.cs
- WmlTextViewAdapter.cs
- FragmentQueryKB.cs
- DependentList.cs
- DocumentViewerHelper.cs
- Effect.cs
- TrackingExtract.cs
- DataTablePropertyDescriptor.cs
- ByteConverter.cs
- VectorAnimation.cs
- InheritablePropertyChangeInfo.cs
- OrderedEnumerableRowCollection.cs
- Line.cs
- WSDualHttpSecurity.cs
- Pens.cs
- Int16.cs
- WebAdminConfigurationHelper.cs
- GraphicsState.cs
- CodeBinaryOperatorExpression.cs
- UidPropertyAttribute.cs
- Trace.cs
- HostingPreferredMapPath.cs
- Inflater.cs
- GetWinFXPath.cs
- TextBoxAutomationPeer.cs
- GB18030Encoding.cs
- AssertHelper.cs
- WindowsListViewGroupSubsetLink.cs
- HtmlTableRowCollection.cs
- ConfigXmlWhitespace.cs
- OpacityConverter.cs
- MergePropertyDescriptor.cs
- PropertyDescriptors.cs
- HtmlHistory.cs
- BasicHttpBindingCollectionElement.cs
- CacheAxisQuery.cs
- TemplateParser.cs
- SizeFConverter.cs
- UniqueEventHelper.cs
- EntityContainer.cs
- _DigestClient.cs
- DrawingVisual.cs
- ExpressionParser.cs
- ExternalFile.cs
- PeerNameRecord.cs
- ControlCachePolicy.cs
- TextElementEnumerator.cs
- NotFiniteNumberException.cs
- ISAPIRuntime.cs
- CalendarDay.cs
- ReadOnlyHierarchicalDataSourceView.cs
- PageParserFilter.cs
- InternalSafeNativeMethods.cs
- StringArrayEditor.cs
- SpecialNameAttribute.cs
- SafeNativeMethods.cs
- IsolatedStorageFilePermission.cs
- XmlArrayItemAttributes.cs
- DataBoundControl.cs
- ScriptIgnoreAttribute.cs
- SystemResources.cs
- Section.cs
- MemberDomainMap.cs
- FileCodeGroup.cs
- ConstrainedGroup.cs
- OleStrCAMarshaler.cs
- TextMarkerSource.cs
- DBConcurrencyException.cs
- LocalServiceSecuritySettings.cs
- ComponentTray.cs
- DataGridParentRows.cs
- ParameterCollection.cs
- propertyentry.cs
- DescendantBaseQuery.cs
- SubqueryTrackingVisitor.cs
- CharAnimationUsingKeyFrames.cs
- ACE.cs
- MenuItemStyle.cs
- CompositeTypefaceMetrics.cs
- EventMappingSettingsCollection.cs
- ColorTransform.cs
- SqlWriter.cs
- ApplicationId.cs
- DataGridViewMethods.cs
- ProfileParameter.cs
- XmlCharType.cs
- QueryOptionExpression.cs
- BuildProvider.cs
- LocationSectionRecord.cs
- ViewStateException.cs