Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / Behavior / NoResizeSelectionBorderGlyph.cs / 1 / NoResizeSelectionBorderGlyph.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 NoResizeSelectionBorderGlyph draws one side (depending on type) of a SelectionBorder. /// internal class NoResizeSelectionBorderGlyph : SelectionGlyphBase { ////// /// This constructor extends from the standard SelectionGlyphBase constructor. /// internal NoResizeSelectionBorderGlyph(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; if ((selRules & SelectionRules.Moveable) != 0) { rules = SelectionRules.Moveable; hitTestCursor = Cursors.SizeAll; } //this will return the rect representing the bounds of the glyph bounds = DesignerUtils.GetBoundsForNoResizeSelectionType(controlBounds, type); hitBounds = bounds; // The hitbounds for the border is actually a bit bigger than the glyph bounds switch (type) { case SelectionBorderGlyphType.Top: goto case SelectionBorderGlyphType.Bottom; case SelectionBorderGlyphType.Bottom: // 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: goto case SelectionBorderGlyphType.Right; case SelectionBorderGlyphType.Right: // 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
- coordinator.cs
- RequestCache.cs
- TraceUtility.cs
- ReturnEventArgs.cs
- InternalsVisibleToAttribute.cs
- DataGridViewBand.cs
- Substitution.cs
- VisualTarget.cs
- ReaderWriterLock.cs
- Geometry.cs
- EntityReference.cs
- peernodeimplementation.cs
- GlobalizationSection.cs
- CompositeScriptReferenceEventArgs.cs
- DefaultProxySection.cs
- UrlMapping.cs
- PopupRoot.cs
- ManagementEventArgs.cs
- RSAPKCS1SignatureFormatter.cs
- XmlnsCache.cs
- DynamicResourceExtension.cs
- TextOnlyOutput.cs
- HashHelpers.cs
- ExecutionContext.cs
- DCSafeHandle.cs
- ListViewItem.cs
- ReversePositionQuery.cs
- PolicyManager.cs
- UncommonField.cs
- JsonQNameDataContract.cs
- Win32Exception.cs
- OuterGlowBitmapEffect.cs
- PkcsUtils.cs
- NameScopePropertyAttribute.cs
- WbmpConverter.cs
- MetadataCache.cs
- FormViewPageEventArgs.cs
- RC2.cs
- ResourceSet.cs
- AudioFileOut.cs
- SmiSettersStream.cs
- SpeakCompletedEventArgs.cs
- FileEnumerator.cs
- ConvertEvent.cs
- XPathScanner.cs
- HitTestResult.cs
- CryptoKeySecurity.cs
- SpeechUI.cs
- WebPartConnection.cs
- Constants.cs
- ModuleBuilderData.cs
- WebControlsSection.cs
- ListBindableAttribute.cs
- HttpHandlerActionCollection.cs
- FieldInfo.cs
- BaseComponentEditor.cs
- XmlDigitalSignatureProcessor.cs
- ShaderEffect.cs
- IndexingContentUnit.cs
- DefinitionUpdate.cs
- AutomationPeer.cs
- TreeWalkHelper.cs
- WhitespaceSignificantCollectionAttribute.cs
- UTF32Encoding.cs
- UnknownExceptionActionHelper.cs
- BaseValidator.cs
- CodeAttributeDeclaration.cs
- RegexNode.cs
- TransactionManager.cs
- BooleanAnimationUsingKeyFrames.cs
- MenuAdapter.cs
- WebPartConnectionsCloseVerb.cs
- UidManager.cs
- NullableFloatSumAggregationOperator.cs
- AnnotationHighlightLayer.cs
- UrlPath.cs
- ApplicationManager.cs
- Matrix3D.cs
- SQLBinaryStorage.cs
- TransportConfigurationTypeElementCollection.cs
- OdbcParameterCollection.cs
- MultipartContentParser.cs
- ColorContextHelper.cs
- PolyLineSegmentFigureLogic.cs
- DataGridItemEventArgs.cs
- _FixedSizeReader.cs
- DBCommandBuilder.cs
- SafeHandles.cs
- Size3D.cs
- OrderedDictionary.cs
- RenderCapability.cs
- InterleavedZipPartStream.cs
- TextDecorations.cs
- MailHeaderInfo.cs
- Configuration.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- XmlEncoding.cs
- MultipleViewPatternIdentifiers.cs
- ProxyGenerator.cs
- MatrixAnimationUsingKeyFrames.cs