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
- DbParameterHelper.cs
- BindValidationContext.cs
- EnvironmentPermission.cs
- ConnectionPoint.cs
- HttpWriter.cs
- WebControlsSection.cs
- OutputCacheModule.cs
- brushes.cs
- SR.cs
- CodeCastExpression.cs
- LongValidatorAttribute.cs
- VirtualizingStackPanel.cs
- WindowsGraphics.cs
- LongValidator.cs
- AnnotationAuthorChangedEventArgs.cs
- ScrollPatternIdentifiers.cs
- AsymmetricCryptoHandle.cs
- ContextInformation.cs
- Stream.cs
- AnonymousIdentificationModule.cs
- Validator.cs
- SizeLimitedCache.cs
- SafeTokenHandle.cs
- VerifyHashRequest.cs
- FontFamilyIdentifier.cs
- QuaternionKeyFrameCollection.cs
- DbParameterHelper.cs
- ScriptResourceDefinition.cs
- Buffer.cs
- EntityUtil.cs
- FrameworkElementAutomationPeer.cs
- datacache.cs
- StatusBarAutomationPeer.cs
- WorkflowOwnerAsyncResult.cs
- BindingMAnagerBase.cs
- StateMachineHelpers.cs
- DataTransferEventArgs.cs
- XAMLParseException.cs
- XmlSchemaType.cs
- DBSchemaTable.cs
- Int32Rect.cs
- OleDbRowUpdatedEvent.cs
- PasswordRecovery.cs
- BamlLocalizationDictionary.cs
- SpecialTypeDataContract.cs
- ServiceProviders.cs
- filewebresponse.cs
- CardSpaceException.cs
- EntityContainerRelationshipSetEnd.cs
- QueryOptionExpression.cs
- FunctionCommandText.cs
- ComboBoxRenderer.cs
- IERequestCache.cs
- UnsafeNativeMethodsCLR.cs
- CustomTypeDescriptor.cs
- Point3D.cs
- AspNetRouteServiceHttpHandler.cs
- CLSCompliantAttribute.cs
- ViewKeyConstraint.cs
- VirtualPath.cs
- WebSysDescriptionAttribute.cs
- DataGridColumn.cs
- Internal.cs
- _SecureChannel.cs
- ControlSerializer.cs
- TextParentUndoUnit.cs
- Pair.cs
- DependencyProperty.cs
- SafeHandles.cs
- NameNode.cs
- SqlSelectStatement.cs
- WebBrowserNavigatedEventHandler.cs
- TypeUtils.cs
- SortFieldComparer.cs
- ServiceDesigner.xaml.cs
- Helper.cs
- RotateTransform3D.cs
- CapiSafeHandles.cs
- _LazyAsyncResult.cs
- RichTextBox.cs
- TypeToken.cs
- TimeoutTimer.cs
- ActivityMarkupSerializer.cs
- DataGridViewMethods.cs
- DataGridViewTextBoxColumn.cs
- BeginStoryboard.cs
- ByteAnimationBase.cs
- PersianCalendar.cs
- XmlArrayItemAttribute.cs
- SqlNamer.cs
- PageVisual.cs
- InkSerializer.cs
- ProcessHostMapPath.cs
- QilInvokeLateBound.cs
- InputLanguageCollection.cs
- ThicknessKeyFrameCollection.cs
- TextSpan.cs
- ApplicationServiceManager.cs
- TemplatePagerField.cs
- RowSpanVector.cs