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
- EventListener.cs
- DataListItemEventArgs.cs
- JsonXmlDataContract.cs
- ToolboxDataAttribute.cs
- DbConnectionPoolOptions.cs
- TextBreakpoint.cs
- AccessViolationException.cs
- Grant.cs
- TraceSource.cs
- ErrorStyle.cs
- assertwrapper.cs
- recordstatefactory.cs
- ServiceBusyException.cs
- MinMaxParagraphWidth.cs
- SrgsDocumentParser.cs
- AssemblyLoader.cs
- EnumConverter.cs
- CacheHelper.cs
- FontInfo.cs
- ContentType.cs
- ProgressBarBrushConverter.cs
- Matrix3D.cs
- CaseCqlBlock.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- Configuration.cs
- Restrictions.cs
- Documentation.cs
- GenericAuthenticationEventArgs.cs
- PageThemeCodeDomTreeGenerator.cs
- XmlSchemaIdentityConstraint.cs
- ItemAutomationPeer.cs
- DataSetUtil.cs
- XmlException.cs
- ListControlBoundActionList.cs
- XpsImage.cs
- XmlCodeExporter.cs
- Base64Encoder.cs
- EventPrivateKey.cs
- DirectoryNotFoundException.cs
- PassportIdentity.cs
- SqlDataSourceSelectingEventArgs.cs
- Rfc2898DeriveBytes.cs
- CriticalExceptions.cs
- EncryptedPackage.cs
- TransportSecurityProtocolFactory.cs
- ReadContentAsBinaryHelper.cs
- OperationResponse.cs
- LongPath.cs
- MemberRelationshipService.cs
- Int16Animation.cs
- Rfc2898DeriveBytes.cs
- MediaElement.cs
- MessageSecurityOverMsmq.cs
- ProxyRpc.cs
- MessagePropertyFilter.cs
- DnsElement.cs
- SwitchAttribute.cs
- CodeTypeReference.cs
- SafeHGlobalHandleCritical.cs
- Rotation3D.cs
- PeerToPeerException.cs
- DesignerRegionCollection.cs
- Model3DGroup.cs
- TCEAdapterGenerator.cs
- HierarchicalDataBoundControlAdapter.cs
- SchemaAttDef.cs
- ZipIOExtraFieldElement.cs
- DbConnectionPoolGroup.cs
- HttpCacheParams.cs
- PageTheme.cs
- ToggleButtonAutomationPeer.cs
- ResourceContainer.cs
- MatrixValueSerializer.cs
- ElementUtil.cs
- CategoryValueConverter.cs
- NullRuntimeConfig.cs
- DataRelation.cs
- TemplateManager.cs
- MetaData.cs
- LiteralDesigner.cs
- DataProviderNameConverter.cs
- DataControlImageButton.cs
- XmlnsCompatibleWithAttribute.cs
- ProtectedConfigurationSection.cs
- CompiledQuery.cs
- SoapFault.cs
- HttpModuleAction.cs
- NonVisualControlAttribute.cs
- DataGridViewButtonColumn.cs
- AmbientLight.cs
- SqlAggregateChecker.cs
- CompositeCollectionView.cs
- SerializationEventsCache.cs
- Shared.cs
- FileStream.cs
- ResolveDuplex11AsyncResult.cs
- EditingCoordinator.cs
- CursorConverter.cs
- XmlNodeList.cs
- SmtpAuthenticationManager.cs