Code:
/ FX-1434 / FX-1434 / 1.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
- ResourceReferenceExpressionConverter.cs
- __ComObject.cs
- ReliabilityContractAttribute.cs
- PrimaryKeyTypeConverter.cs
- GuidConverter.cs
- ProtocolException.cs
- TokenFactoryFactory.cs
- ResourceProviderFactory.cs
- OdbcEnvironment.cs
- LinkClickEvent.cs
- SafeNativeMethods.cs
- RuntimeComponentFilter.cs
- Propagator.ExtentPlaceholderCreator.cs
- VersionedStreamOwner.cs
- RegexGroupCollection.cs
- ConfigUtil.cs
- ConfigurationPropertyCollection.cs
- datacache.cs
- ResourcesBuildProvider.cs
- BooleanFunctions.cs
- TreeViewEvent.cs
- ZoneLinkButton.cs
- OdbcConnectionStringbuilder.cs
- HttpFileCollectionBase.cs
- InvalidComObjectException.cs
- List.cs
- Normalization.cs
- PrtTicket_Editor.cs
- CompiledIdentityConstraint.cs
- NTAccount.cs
- ExecutionEngineException.cs
- Models.cs
- SortAction.cs
- EntitySqlException.cs
- Style.cs
- MainMenu.cs
- NewItemsContextMenuStrip.cs
- RuleValidation.cs
- XPSSignatureDefinition.cs
- DataViewSetting.cs
- FormViewUpdatedEventArgs.cs
- Types.cs
- ResourceCategoryAttribute.cs
- dtdvalidator.cs
- StoragePropertyMapping.cs
- CodeRemoveEventStatement.cs
- BooleanStorage.cs
- HttpApplicationFactory.cs
- DataSourceConverter.cs
- _WebProxyDataBuilder.cs
- FormView.cs
- MouseGestureConverter.cs
- CmsInterop.cs
- BindingCompleteEventArgs.cs
- ContextStack.cs
- DataList.cs
- ValidationErrorEventArgs.cs
- Stack.cs
- FixedSOMPage.cs
- ConfigurationManagerHelperFactory.cs
- RefExpr.cs
- CodeGen.cs
- ComboBoxItem.cs
- HttpRequestWrapper.cs
- SimpleWebHandlerParser.cs
- ScriptResourceMapping.cs
- ReferentialConstraint.cs
- JsonQNameDataContract.cs
- FrameDimension.cs
- Calendar.cs
- XmlAnyElementAttributes.cs
- TranslateTransform.cs
- SqlUDTStorage.cs
- Guid.cs
- WebPartZoneBase.cs
- SafeHandle.cs
- CommonBehaviorsSection.cs
- RectAnimation.cs
- ExplicitDiscriminatorMap.cs
- ValidationSummary.cs
- PreservationFileReader.cs
- DrawingImage.cs
- SmiXetterAccessMap.cs
- CustomBindingCollectionElement.cs
- TransactionScope.cs
- SupportingTokenDuplexChannel.cs
- DurableInstance.cs
- wgx_exports.cs
- Unit.cs
- ContentControl.cs
- DelegateTypeInfo.cs
- WebDescriptionAttribute.cs
- WaitingCursor.cs
- SevenBitStream.cs
- TimeSpanValidatorAttribute.cs
- UpdatePanelTriggerCollection.cs
- VBIdentifierTrimConverter.cs
- WebPartActionVerb.cs
- XsltOutput.cs
- UserInitiatedNavigationPermission.cs