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
- BooleanExpr.cs
- TextModifierScope.cs
- DbMetaDataCollectionNames.cs
- BlockUIContainer.cs
- KeyValuePair.cs
- ObservableDictionary.cs
- TrustSection.cs
- CursorConverter.cs
- PipeStream.cs
- Int16.cs
- ReadWriteObjectLock.cs
- TextEffectResolver.cs
- PathFigure.cs
- ClientTargetSection.cs
- DbException.cs
- InvalidWMPVersionException.cs
- SamlAction.cs
- GeneralTransformGroup.cs
- ConsoleCancelEventArgs.cs
- Propagator.JoinPropagator.cs
- WorkflowMessageEventArgs.cs
- ItemDragEvent.cs
- DoubleIndependentAnimationStorage.cs
- SubstitutionDesigner.cs
- DataBinder.cs
- TreeViewBindingsEditorForm.cs
- SoapObjectWriter.cs
- ErrorFormatterPage.cs
- PixelShader.cs
- WinInetCache.cs
- AvTraceDetails.cs
- contentDescriptor.cs
- TaskFormBase.cs
- Interlocked.cs
- QueryLifecycle.cs
- _RequestCacheProtocol.cs
- ClientRuntime.cs
- PermissionSetEnumerator.cs
- ProfileSettingsCollection.cs
- ActivityBindForm.cs
- _TransmitFileOverlappedAsyncResult.cs
- RequiredArgumentAttribute.cs
- TreeNodeStyle.cs
- ClientEndpointLoader.cs
- FormattedTextSymbols.cs
- SessionSwitchEventArgs.cs
- EnlistmentTraceIdentifier.cs
- ItemPager.cs
- CardSpacePolicyElement.cs
- Setter.cs
- WorkerRequest.cs
- DiscriminatorMap.cs
- StreamWithDictionary.cs
- RewritingSimplifier.cs
- _NTAuthentication.cs
- Compilation.cs
- CompilerError.cs
- DefaultParameterValueAttribute.cs
- SqlFlattener.cs
- SqlInfoMessageEvent.cs
- DataFieldEditor.cs
- LayoutTableCell.cs
- ToolStripGrip.cs
- hresults.cs
- SmtpNegotiateAuthenticationModule.cs
- uribuilder.cs
- SymLanguageVendor.cs
- ColorTransformHelper.cs
- Hex.cs
- LifetimeServices.cs
- SiteMapPath.cs
- Point3DAnimation.cs
- TreeIterator.cs
- _BufferOffsetSize.cs
- TextTreeTextElementNode.cs
- DeadLetterQueue.cs
- ToolStripPanel.cs
- MulticastDelegate.cs
- TemplateBuilder.cs
- RSAPKCS1SignatureDeformatter.cs
- DefaultPropertiesToSend.cs
- ExpressionParser.cs
- TypeInfo.cs
- SoapAttributes.cs
- _ContextAwareResult.cs
- ParserContext.cs
- SqlDataSourceCommandEventArgs.cs
- GroupBoxRenderer.cs
- OleDbEnumerator.cs
- WindowsFormsSynchronizationContext.cs
- DynamicEntity.cs
- COM2PictureConverter.cs
- LocalValueEnumerator.cs
- VisualBrush.cs
- SqlXmlStorage.cs
- GeometryCombineModeValidation.cs
- SingleConverter.cs
- ByteAnimationBase.cs
- ResponseBodyWriter.cs
- HttpCookie.cs