Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / Behavior / BodyGlyph.cs / 1 / BodyGlyph.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; ////// /// This Glyph is placed on every control sized to the exact bounds of /// the control. /// public class ControlBodyGlyph : ComponentGlyph { private Rectangle bounds; //bounds of the related control private Cursor hitTestCursor; //cursor used to hit test private IComponent component; ////// /// Standard Constructor. /// public ControlBodyGlyph(Rectangle bounds, Cursor cursor, IComponent relatedComponent, ControlDesigner designer) : base(relatedComponent, new ControlDesigner.TransparentBehavior(designer)) { this.bounds = bounds; this.hitTestCursor = cursor; this.component = relatedComponent; } public ControlBodyGlyph(Rectangle bounds, Cursor cursor, IComponent relatedComponent, Behavior behavior) : base(relatedComponent, behavior) { this.bounds = bounds; this.hitTestCursor = cursor; this.component = relatedComponent; } ////// /// Simple hit test rule: if the point is contained within the bounds /// AND the component is Visible (controls on some tab pages may /// not be, for ex) then it is a positive hit test. /// public override Cursor GetHitTest(Point p) { bool isVisible = (component is Control) ? ((Control)component).Visible : true; /*non-controls are always visible here*/ if (isVisible && bounds.Contains(p)) { return hitTestCursor; } return null; } ////// /// The bounds of this glyph. /// public override Rectangle Bounds { get { return bounds; } } } } // 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
- Parameter.cs
- Dynamic.cs
- SdlChannelSink.cs
- XmlReaderDelegator.cs
- SiteMapProvider.cs
- Int64KeyFrameCollection.cs
- PageVisual.cs
- Root.cs
- NameNode.cs
- TextFormatterContext.cs
- PropertyBuilder.cs
- Point.cs
- UIAgentMonitorHandle.cs
- ExternalCalls.cs
- SplineQuaternionKeyFrame.cs
- InlineUIContainer.cs
- EntityDataSourceView.cs
- mediaclock.cs
- ADRole.cs
- OleDbCommand.cs
- EntityCommandCompilationException.cs
- CmsInterop.cs
- TabItemWrapperAutomationPeer.cs
- ModelItemKeyValuePair.cs
- QuaternionAnimationBase.cs
- Helpers.cs
- ObjRef.cs
- OperatingSystem.cs
- HitTestDrawingContextWalker.cs
- RelativeSource.cs
- SrgsElement.cs
- DefaultTraceListener.cs
- XPathParser.cs
- UnsafeNativeMethods.cs
- PtsHelper.cs
- TableLayoutStyleCollection.cs
- MaterialGroup.cs
- XamlSerializerUtil.cs
- Oid.cs
- EndpointDispatcher.cs
- TransactionContext.cs
- StatusBarItemAutomationPeer.cs
- DragDropHelper.cs
- X509CertificateValidator.cs
- LinkLabel.cs
- KeyedHashAlgorithm.cs
- DataSourceConverter.cs
- EventLogEntry.cs
- StreamProxy.cs
- EntityWithKeyStrategy.cs
- CounterCreationDataCollection.cs
- ScrollItemProviderWrapper.cs
- SafeProcessHandle.cs
- FileDialog_Vista_Interop.cs
- WindowsImpersonationContext.cs
- BuildManager.cs
- PenLineCapValidation.cs
- X509CertificateEndpointIdentity.cs
- TransformGroup.cs
- DataTemplate.cs
- RegexRunner.cs
- CodePrimitiveExpression.cs
- MetadataFile.cs
- ServiceProviders.cs
- XmlRootAttribute.cs
- PropertyMetadata.cs
- SchemaHelper.cs
- QilName.cs
- ContentType.cs
- TextRangeEdit.cs
- CapabilitiesState.cs
- PngBitmapEncoder.cs
- VerificationAttribute.cs
- ArgumentDirectionHelper.cs
- FlowNode.cs
- XmlDataDocument.cs
- AppDomainCompilerProxy.cs
- CounterSampleCalculator.cs
- ItemType.cs
- odbcmetadatafactory.cs
- HttpHeaderCollection.cs
- SafeArchiveContext.cs
- RightsManagementPermission.cs
- ContentFileHelper.cs
- WebHttpEndpoint.cs
- XmlSchemaRedefine.cs
- StsCommunicationException.cs
- XmlLanguage.cs
- X509SubjectKeyIdentifierClause.cs
- DrawItemEvent.cs
- XsdBuilder.cs
- ControlBuilder.cs
- GlobalizationAssembly.cs
- WebPartManagerInternals.cs
- DataGridViewComboBoxEditingControl.cs
- SystemIPGlobalProperties.cs
- SqlDelegatedTransaction.cs
- xml.cs
- Binding.cs
- CredentialCache.cs