Code:
/ FX-1434 / FX-1434 / 1.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
- GraphicsContainer.cs
- EllipseGeometry.cs
- StaticFileHandler.cs
- IndexedString.cs
- PictureBoxDesigner.cs
- FormViewModeEventArgs.cs
- XmlSchemaSearchPattern.cs
- InfoCardBinaryReader.cs
- PackageDigitalSignature.cs
- wgx_exports.cs
- CroppedBitmap.cs
- ErrorBehavior.cs
- SamlSecurityTokenAuthenticator.cs
- MasterPageBuildProvider.cs
- CheckBox.cs
- PTConverter.cs
- GridViewColumnHeaderAutomationPeer.cs
- MulticastOption.cs
- WebColorConverter.cs
- TextElementCollection.cs
- SoundPlayer.cs
- File.cs
- DrawingBrush.cs
- WindowsSlider.cs
- Misc.cs
- FacetDescriptionElement.cs
- KeyToListMap.cs
- ConfigurationLockCollection.cs
- DataSourceControl.cs
- EditorResources.cs
- BindingCompleteEventArgs.cs
- AdornerLayer.cs
- CollectionView.cs
- EntityKey.cs
- ToolBarButton.cs
- RtfFormatStack.cs
- DataBindingList.cs
- SpellCheck.cs
- GPStream.cs
- StringBuilder.cs
- Activity.cs
- LinkButton.cs
- InputElement.cs
- XmlMembersMapping.cs
- WpfGeneratedKnownTypes.cs
- SiteMapNodeItemEventArgs.cs
- ConfigurationLocation.cs
- ConditionCollection.cs
- SafeProcessHandle.cs
- TypeFieldSchema.cs
- ListViewDeleteEventArgs.cs
- InstanceDataCollection.cs
- infer.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- FieldToken.cs
- BitStream.cs
- WorkerRequest.cs
- CommandHelpers.cs
- ConfigurationElementProperty.cs
- PageVisual.cs
- SqlDataSource.cs
- StrokeSerializer.cs
- Int32.cs
- AnnotationService.cs
- MeasureItemEvent.cs
- XmlNullResolver.cs
- MembershipUser.cs
- VideoDrawing.cs
- HostedHttpTransportManager.cs
- Rights.cs
- StringOutput.cs
- RepeaterCommandEventArgs.cs
- ProviderConnectionPointCollection.cs
- FixUp.cs
- BuildProviderCollection.cs
- MethodImplAttribute.cs
- AspCompat.cs
- ICollection.cs
- ContentPresenter.cs
- WebConfigurationFileMap.cs
- GridLength.cs
- SqlClientFactory.cs
- LassoSelectionBehavior.cs
- SR.cs
- UniqueConstraint.cs
- ViewValidator.cs
- FormsAuthenticationEventArgs.cs
- RefType.cs
- ApplicationDirectory.cs
- UrlUtility.cs
- SapiRecognizer.cs
- DataTableMapping.cs
- GroupedContextMenuStrip.cs
- SafeLibraryHandle.cs
- GridViewSortEventArgs.cs
- SafeSecurityHandles.cs
- ImageFormatConverter.cs
- JsonReaderWriterFactory.cs
- Model3DCollection.cs
- ListViewSelectEventArgs.cs