Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ToolStripItemGlyph.cs / 2 / ToolStripItemGlyph.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Windows.Forms.Design {
using System.Design;
using Accessibility;
using System.Runtime.Serialization.Formatters;
using System.Threading;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Diagnostics;
using System;
using System.Security;
using System.Security.Permissions;
using System.Collections;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Design;
using Microsoft.Win32;
using System.Windows.Forms.Design.Behavior;
using System.Reflection;
///
/// The glyph we put over the items. Basically this sets the hit-testable area of the item itself.
///
internal class ToolStripItemGlyph : ControlBodyGlyph{
private ToolStripItem _item;
private Rectangle _bounds;
private ToolStripItemDesigner _itemDesigner;
public ToolStripItemGlyph(ToolStripItem item, ToolStripItemDesigner itemDesigner, Rectangle bounds, System.Windows.Forms.Design.Behavior.Behavior b) : base(bounds, Cursors.Default, item, b) {
_item = item;
_bounds = bounds;
_itemDesigner = itemDesigner;
}
public ToolStripItem Item {
get {
return _item;
}
}
public override Rectangle Bounds {
get {
return _bounds;
}
}
public ToolStripItemDesigner ItemDesigner {
get {
return _itemDesigner;
}
}
///
///
/// Abstract method that forces Glyph implementations to provide
/// hit test logic. Given any point - if the Glyph has decided to
/// be involved with that location, the Glyph will need to return
/// a valid Cursor. Otherwise, returning null will cause the
/// the BehaviorService to simply ignore it.
///
public override Cursor GetHitTest(Point p) {
if (_item.Visible && _bounds.Contains(p)) {
return Cursors.Default;
}
return null;
}
///
///
/// Control host dont draw on Invalidation...
///
public override void Paint(PaintEventArgs pe) {
if (_item is ToolStripControlHost && _item.IsOnDropDown )
{
if( _item is System.Windows.Forms.ToolStripComboBox && VisualStyles.VisualStyleRenderer.IsSupported) {
// When processing WM_PAINT and the OS has a theme enabled, the native ComboBox sends a WM_PAINT
// message to its parent when a theme is enabled in the OS forcing a repaint in the AdornerWindow
// generating an infinite WM_PAINT message processing loop. We guard against this here. See DDB#99105.
return;
}
_item.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
- RIPEMD160.cs
- Inline.cs
- GridViewCommandEventArgs.cs
- FileRegion.cs
- StorageSetMapping.cs
- SqlDependencyUtils.cs
- NumericExpr.cs
- Operators.cs
- EncodingNLS.cs
- TraceProvider.cs
- PageTheme.cs
- ProxyGenerator.cs
- DynamicILGenerator.cs
- GacUtil.cs
- BuilderInfo.cs
- CodeSnippetStatement.cs
- ScriptControlManager.cs
- SchemaEntity.cs
- Padding.cs
- SchemaObjectWriter.cs
- SocketAddress.cs
- HtmlInputRadioButton.cs
- PointUtil.cs
- DataRelationCollection.cs
- QueryAccessibilityHelpEvent.cs
- PrintSchema.cs
- CommandTreeTypeHelper.cs
- ConfigXmlReader.cs
- DriveInfo.cs
- DbFunctionCommandTree.cs
- EventWaitHandleSecurity.cs
- ByteStreamMessageEncodingElement.cs
- filewebresponse.cs
- SplitterDesigner.cs
- CharUnicodeInfo.cs
- DBConnectionString.cs
- FtpRequestCacheValidator.cs
- WorkflowMessageEventArgs.cs
- TemplateField.cs
- ResourceDictionaryCollection.cs
- KeyboardDevice.cs
- NotifyParentPropertyAttribute.cs
- MetadataResolver.cs
- TypeToStringValueConverter.cs
- sqlinternaltransaction.cs
- DataSourceCache.cs
- ToggleButton.cs
- DataGridPagerStyle.cs
- VectorCollection.cs
- UnsignedPublishLicense.cs
- _BasicClient.cs
- HttpResponseBase.cs
- TableAdapterManagerGenerator.cs
- Event.cs
- StringValidatorAttribute.cs
- PropertyPathWorker.cs
- FrameworkName.cs
- ObjectDataSourceSelectingEventArgs.cs
- MetroSerializationManager.cs
- QilName.cs
- UnitySerializationHolder.cs
- ScalarOps.cs
- CryptoConfig.cs
- StaticSiteMapProvider.cs
- CompilerScope.cs
- AxHost.cs
- ConditionalAttribute.cs
- MissingMemberException.cs
- TextTreeTextNode.cs
- storepermissionattribute.cs
- TransformerInfo.cs
- CultureTableRecord.cs
- EmbeddedMailObjectsCollection.cs
- ClockController.cs
- FieldAccessException.cs
- Comparer.cs
- XPathDocumentBuilder.cs
- UpdatePanelTrigger.cs
- Vector3DKeyFrameCollection.cs
- CustomError.cs
- LabelEditEvent.cs
- CompositeCollectionView.cs
- EntityDataSourceDataSelectionPanel.cs
- PreviewPageInfo.cs
- OdbcParameterCollection.cs
- IgnoreSectionHandler.cs
- DataGridViewDataConnection.cs
- Timer.cs
- BooleanAnimationBase.cs
- SecurityRuntime.cs
- ResourceExpressionBuilder.cs
- ThreadSafeList.cs
- FlowPosition.cs
- DataContractSerializerMessageContractImporter.cs
- LinkAreaEditor.cs
- WebServiceEnumData.cs
- webbrowsersite.cs
- ObjectViewQueryResultData.cs
- DbMetaDataFactory.cs
- CompileLiteralTextParser.cs