Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / Behavior / SelectionBorderGlyph.cs / 1 / SelectionBorderGlyph.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.Windows.Forms.Design; ////// /// The SelectionBorderGlyph draws one side (depending on type) of a SelectionBorder. /// internal class SelectionBorderGlyph : SelectionGlyphBase { ////// /// This constructor extends from the standard SelectionGlyphBase constructor. /// internal SelectionBorderGlyph(Rectangle controlBounds, SelectionRules rules, SelectionBorderGlyphType type, Behavior behavior) : base(behavior) { InitializeGlyph(controlBounds, rules, type); } ////// Helper function that initializes the Glyph based on bounds, type, and bordersize. /// private void InitializeGlyph(Rectangle controlBounds, SelectionRules selRules, SelectionBorderGlyphType type) { rules = SelectionRules.None; hitTestCursor = Cursors.Default; //this will return the rect representing the bounds of the glyph bounds = DesignerUtils.GetBoundsForSelectionType(controlBounds, type); hitBounds = bounds; // The hitbounds for the border is actually a bit bigger than the glyph bounds switch (type) { case SelectionBorderGlyphType.Top: if ((selRules & SelectionRules.TopSizeable) != 0) { hitTestCursor = Cursors.SizeNS; rules = SelectionRules.TopSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the top and the bottom of the selection border glyph hitBounds.Y -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Height += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Bottom: if ((selRules & SelectionRules.BottomSizeable) != 0) { hitTestCursor = Cursors.SizeNS; rules = SelectionRules.BottomSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the top and the bottom of the selection border glyph hitBounds.Y -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Height += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Left: if ((selRules & SelectionRules.LeftSizeable) != 0) { hitTestCursor = Cursors.SizeWE; rules = SelectionRules.LeftSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the left and the right of the selection border glyph hitBounds.X -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Width += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; case SelectionBorderGlyphType.Right: if ((selRules & SelectionRules.RightSizeable) != 0) { hitTestCursor = Cursors.SizeWE; rules = SelectionRules.RightSizeable; } // We want to apply the SELECTIONBORDERHITAREA to the left and the right of the selection border glyph hitBounds.X -= (DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE) / 2; hitBounds.Width += DesignerUtils.SELECTIONBORDERHITAREA - DesignerUtils.SELECTIONBORDERSIZE; break; } } ////// /// Simple painting logic for selection Glyphs. /// public override void Paint(PaintEventArgs pe) { DesignerUtils.DrawSelectionBorder(pe.Graphics, 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
- VerificationException.cs
- UnsafeNativeMethods.cs
- ListBoxAutomationPeer.cs
- ColorAnimationBase.cs
- Module.cs
- MetadataArtifactLoaderComposite.cs
- DockProviderWrapper.cs
- EntitySet.cs
- DecimalAnimationBase.cs
- TextTreeRootTextBlock.cs
- ArgumentsParser.cs
- HtmlControl.cs
- MetadataItemCollectionFactory.cs
- CalendarDay.cs
- SqlParameterCollection.cs
- Timer.cs
- GestureRecognizer.cs
- Aggregates.cs
- XmlConvert.cs
- SourceElementsCollection.cs
- XmlNodeComparer.cs
- ReflectPropertyDescriptor.cs
- PageFunction.cs
- SchemaHelper.cs
- MaskedTextProvider.cs
- ModuleBuilderData.cs
- DataTemplateSelector.cs
- DependencyObjectPropertyDescriptor.cs
- WindowExtensionMethods.cs
- EntityWrapperFactory.cs
- PolicyLevel.cs
- Parser.cs
- DiagnosticTrace.cs
- JulianCalendar.cs
- ResourcePart.cs
- ImageMetadata.cs
- MediaTimeline.cs
- BindingExpressionBase.cs
- TextRunProperties.cs
- ScrollBarAutomationPeer.cs
- TcpProcessProtocolHandler.cs
- Control.cs
- SamlConditions.cs
- StreamAsIStream.cs
- UDPClient.cs
- Clause.cs
- XPathBuilder.cs
- PrintDialog.cs
- SqlUtils.cs
- Ref.cs
- Win32.cs
- ServiceDescriptionData.cs
- QuadraticEase.cs
- FileClassifier.cs
- EntityDataSourceQueryBuilder.cs
- Permission.cs
- PermissionToken.cs
- PropVariant.cs
- XmlValidatingReaderImpl.cs
- SerializationFieldInfo.cs
- SerTrace.cs
- DataGridViewAccessibleObject.cs
- AnimationStorage.cs
- CodeCompiler.cs
- CodeRegionDirective.cs
- AppSecurityManager.cs
- SqlNodeTypeOperators.cs
- PropertyGridEditorPart.cs
- ConstantCheck.cs
- XmlIlTypeHelper.cs
- HelpInfo.cs
- ConfigXmlElement.cs
- ReferenceSchema.cs
- DependencySource.cs
- SamlAuthorityBinding.cs
- DynamicMethod.cs
- InkCanvasInnerCanvas.cs
- SmtpFailedRecipientsException.cs
- Message.cs
- CFGGrammar.cs
- TextCompositionManager.cs
- MimePart.cs
- TypedCompletedAsyncResult.cs
- HScrollProperties.cs
- FileSystemWatcher.cs
- EntityDataSourceColumn.cs
- SqlDataReader.cs
- ParameterCollection.cs
- KeyboardDevice.cs
- SafeLibraryHandle.cs
- SettingsAttributes.cs
- FieldBuilder.cs
- CrossContextChannel.cs
- HttpApplication.cs
- _UriSyntax.cs
- Rect3D.cs
- SafeCryptContextHandle.cs
- DesignerActionItemCollection.cs
- BufferedReadStream.cs
- TabRenderer.cs