Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / Behavior / ContainerSelectorGlyph.cs / 1 / ContainerSelectorGlyph.cs
namespace System.Windows.Forms.Design.Behavior { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms.Design; using System.Windows.Forms; ////// /// This is the glyph used to drag container controls around the designer. /// This glyph (and associated behavior) is created by the ParentControlDesigner. /// internal sealed class ContainerSelectorGlyph : Glyph { private Rectangle glyphBounds; private ContainerSelectorBehavior relatedBehavior; ////// /// ContainerSelectorGlyph constructor. /// internal ContainerSelectorGlyph(Rectangle containerBounds, int glyphSize, int glyphOffset, ContainerSelectorBehavior behavior) : base(behavior) { relatedBehavior = (ContainerSelectorBehavior)behavior; glyphBounds = new Rectangle(containerBounds.X + glyphOffset, containerBounds.Y - (int)(glyphSize * .5), glyphSize, glyphSize); } ////// /// The bounds of this Glyph. /// public override Rectangle Bounds { get { return glyphBounds; } } public Behavior RelatedBehavior { get { return relatedBehavior; } } ////// /// Simple hit test rule: if the point is contained within the bounds /// - then it is a positive hit test. /// public override Cursor GetHitTest(Point p) { if (glyphBounds.Contains(p) || relatedBehavior.OkToMove) { return Cursors.SizeAll; } return null; } private Bitmap glyph = null; private Bitmap MoveGlyph { get { if (glyph == null) { glyph = new Bitmap(typeof(ContainerSelectorGlyph), "MoverGlyph.bmp"); glyph.MakeTransparent(); } return glyph; } } ////// /// Very simple paint logic. /// public override void Paint(PaintEventArgs pe) { pe.Graphics.DrawImage(MoveGlyph, glyphBounds); } } } // 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
- CurrencyManager.cs
- EntityModelSchemaGenerator.cs
- CompositeDataBoundControl.cs
- ServiceOperationWrapper.cs
- InvalidWorkflowException.cs
- ReadWriteObjectLock.cs
- TimelineGroup.cs
- EmbeddedMailObject.cs
- ListViewHitTestInfo.cs
- XmlTypeMapping.cs
- StyleModeStack.cs
- EdmItemCollection.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- XmlSchemaAnnotated.cs
- StringUtil.cs
- DataListComponentEditor.cs
- ObjectQueryState.cs
- Types.cs
- HtmlTitle.cs
- CssClassPropertyAttribute.cs
- HtmlTable.cs
- SiteOfOriginContainer.cs
- StrokeCollectionConverter.cs
- MissingFieldException.cs
- ApplicationGesture.cs
- MouseEventArgs.cs
- ApplicationServicesHostFactory.cs
- InternalResources.cs
- IndicShape.cs
- CustomErrorsSectionWrapper.cs
- X509SecurityTokenParameters.cs
- StoreItemCollection.cs
- DocumentGridContextMenu.cs
- KeyInfo.cs
- WmpBitmapEncoder.cs
- SchemaImporterExtensionElementCollection.cs
- BorderGapMaskConverter.cs
- SizeKeyFrameCollection.cs
- RegexStringValidator.cs
- ServicesUtilities.cs
- SqlCommand.cs
- XdrBuilder.cs
- EventsTab.cs
- ParallelForEach.cs
- RepeaterItem.cs
- DrawingAttributeSerializer.cs
- ConfigurationElementCollection.cs
- DebuggerService.cs
- CustomPopupPlacement.cs
- ProcessingInstructionAction.cs
- BigInt.cs
- SqlCacheDependencyDatabaseCollection.cs
- ClassHandlersStore.cs
- OdbcConnectionString.cs
- Button.cs
- DBProviderConfigurationHandler.cs
- ProfileSettingsCollection.cs
- CallSite.cs
- JavascriptCallbackResponseProperty.cs
- ParserHooks.cs
- DataGridTextBoxColumn.cs
- ObjectListComponentEditor.cs
- DbDeleteCommandTree.cs
- RequestCachingSection.cs
- HttpCapabilitiesEvaluator.cs
- ValueHandle.cs
- EventLogTraceListener.cs
- TimeManager.cs
- HotCommands.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- ParameterRefs.cs
- TextTreeNode.cs
- MethodImplAttribute.cs
- DataServiceProcessingPipeline.cs
- AccessDataSourceView.cs
- XslCompiledTransform.cs
- X509Certificate.cs
- ProcessHostMapPath.cs
- UnsafeNativeMethods.cs
- QilUnary.cs
- DefinitionUpdate.cs
- SqlOuterApplyReducer.cs
- XPathSelfQuery.cs
- LogReserveAndAppendState.cs
- SimpleBitVector32.cs
- EntitySqlQueryState.cs
- QilNode.cs
- SqlFunctionAttribute.cs
- CategoryNameCollection.cs
- TrackingProfileManager.cs
- Label.cs
- Permission.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- FileUtil.cs
- SQLBoolean.cs
- SoapSchemaExporter.cs
- ValidationHelpers.cs
- TabItemWrapperAutomationPeer.cs
- SizeLimitedCache.cs
- UnicastIPAddressInformationCollection.cs