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
- securestring.cs
- CroppedBitmap.cs
- RowUpdatingEventArgs.cs
- ServiceModelActivationSectionGroup.cs
- ImpersonateTokenRef.cs
- TemplateControlParser.cs
- PropertyPushdownHelper.cs
- HtmlImage.cs
- DifferencingCollection.cs
- DispatcherOperation.cs
- DefaultBinder.cs
- Parameter.cs
- InternalTypeHelper.cs
- PageFunction.cs
- ValidatorCompatibilityHelper.cs
- printdlgexmarshaler.cs
- SqlBulkCopy.cs
- ExpressionBindingCollection.cs
- BitmapEffectInputData.cs
- TextStore.cs
- TrustLevel.cs
- WSDualHttpBindingElement.cs
- ScrollEventArgs.cs
- PersonalizationStateInfo.cs
- StaticExtensionConverter.cs
- HttpApplication.cs
- ButtonPopupAdapter.cs
- EntitySetBaseCollection.cs
- DocumentPaginator.cs
- RegexMatch.cs
- FileRegion.cs
- CompoundFileStreamReference.cs
- ExtensibleClassFactory.cs
- DbConnectionPool.cs
- ProviderMetadata.cs
- ComNativeDescriptor.cs
- Brush.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Effect.cs
- GroupQuery.cs
- LocationSectionRecord.cs
- RefreshPropertiesAttribute.cs
- PageVisual.cs
- ExpressionVisitor.cs
- Exceptions.cs
- DodSequenceMerge.cs
- TransactionProtocol.cs
- ArglessEventHandlerProxy.cs
- WebPartExportVerb.cs
- PointAnimationUsingPath.cs
- RijndaelCryptoServiceProvider.cs
- XhtmlStyleClass.cs
- COM2EnumConverter.cs
- HttpRuntime.cs
- SmtpAuthenticationManager.cs
- SchemaExporter.cs
- DesignerHelpers.cs
- BigInt.cs
- DataRelationCollection.cs
- WebPartActionVerb.cs
- Documentation.cs
- BCLDebug.cs
- _FtpDataStream.cs
- StyleModeStack.cs
- Header.cs
- _SslSessionsCache.cs
- SQLChars.cs
- NameSpaceExtractor.cs
- TableLayoutCellPaintEventArgs.cs
- InputDevice.cs
- FactoryMaker.cs
- ThousandthOfEmRealDoubles.cs
- As.cs
- AppearanceEditorPart.cs
- ListViewGroupConverter.cs
- Attributes.cs
- ChangeDirector.cs
- RegistryExceptionHelper.cs
- IEnumerable.cs
- TimeSpan.cs
- SqlProcedureAttribute.cs
- DataGridViewCellLinkedList.cs
- ByteRangeDownloader.cs
- PerspectiveCamera.cs
- MultiAsyncResult.cs
- TaiwanLunisolarCalendar.cs
- FixedTextSelectionProcessor.cs
- Policy.cs
- Vector3D.cs
- Parser.cs
- DataChangedEventManager.cs
- UriTemplateVariableQueryValue.cs
- NetStream.cs
- HitTestResult.cs
- Base64Encoding.cs
- RegexFCD.cs
- BuildProviderCollection.cs
- ResXResourceWriter.cs
- WS2007FederationHttpBindingCollectionElement.cs
- TripleDES.cs