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
- CacheSection.cs
- TreeWalker.cs
- FlagPanel.cs
- AuthenticationException.cs
- UiaCoreApi.cs
- BaseAddressPrefixFilterElement.cs
- ContextProperty.cs
- NetMsmqSecurity.cs
- SqlSupersetValidator.cs
- MemberRelationshipService.cs
- PrincipalPermission.cs
- TypeContext.cs
- WindowsFormsHostAutomationPeer.cs
- XmlSchemaComplexContentRestriction.cs
- Qualifier.cs
- autovalidator.cs
- ProvidePropertyAttribute.cs
- RC2CryptoServiceProvider.cs
- DataGridHeaderBorder.cs
- Ray3DHitTestResult.cs
- ProxyWebPartConnectionCollection.cs
- TextServicesDisplayAttributePropertyRanges.cs
- VectorCollectionConverter.cs
- ObjectQuery.cs
- FileLevelControlBuilderAttribute.cs
- ProfileManager.cs
- IntranetCredentialPolicy.cs
- Int64Storage.cs
- XmlC14NWriter.cs
- PropertyMetadata.cs
- InstanceData.cs
- StorageEntityContainerMapping.cs
- basecomparevalidator.cs
- XmlSchemas.cs
- Window.cs
- HierarchicalDataSourceControl.cs
- Directory.cs
- WindowManager.cs
- CompilationRelaxations.cs
- FlowDocumentPageViewerAutomationPeer.cs
- DictionaryTraceRecord.cs
- SettingsPropertyValueCollection.cs
- TypeSystem.cs
- TakeQueryOptionExpression.cs
- PeerNameRecord.cs
- TemplatedAdorner.cs
- DataSourceXmlAttributeAttribute.cs
- VisualTreeHelper.cs
- CompatibleComparer.cs
- LazyLoadBehavior.cs
- SystemInformation.cs
- DrawingContextWalker.cs
- BuildDependencySet.cs
- EntityDataReader.cs
- StopStoryboard.cs
- AsyncOperation.cs
- FilterInvalidBodyAccessException.cs
- SectionUpdates.cs
- Sql8ExpressionRewriter.cs
- HostSecurityManager.cs
- ResXResourceWriter.cs
- DataRowChangeEvent.cs
- SupportedAddressingMode.cs
- ReadOnlyCollection.cs
- WebBrowserDocumentCompletedEventHandler.cs
- ZipIOFileItemStream.cs
- ObjectContext.cs
- BrowserCapabilitiesFactoryBase.cs
- SpellerError.cs
- AlignmentXValidation.cs
- TextSegment.cs
- DataObjectPastingEventArgs.cs
- ContextMarshalException.cs
- DbParameterCollectionHelper.cs
- DataSourceExpressionCollection.cs
- Matrix3DStack.cs
- ListBox.cs
- SQLDateTime.cs
- WorkItem.cs
- EllipticalNodeOperations.cs
- AssemblyResourceLoader.cs
- BitmapData.cs
- ConnectionPoolManager.cs
- XmlMembersMapping.cs
- LongValidatorAttribute.cs
- XPathNavigatorKeyComparer.cs
- AlignmentXValidation.cs
- ControlBindingsCollection.cs
- EventDrivenDesigner.cs
- AmbientLight.cs
- RegexMatch.cs
- UnsafeNativeMethods.cs
- DecimalConverter.cs
- StateManagedCollection.cs
- KeyValueConfigurationElement.cs
- EditorZone.cs
- Accessors.cs
- HtmlHead.cs
- PathSegment.cs
- SqlInternalConnection.cs