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
- DataGridViewCellStateChangedEventArgs.cs
- NamedPipeProcessProtocolHandler.cs
- ClientTargetSection.cs
- Parameter.cs
- OverrideMode.cs
- DesignerDataSourceView.cs
- TemplateBamlRecordReader.cs
- SafeCryptoKeyHandle.cs
- Effect.cs
- TabControlToolboxItem.cs
- smtpconnection.cs
- SpStreamWrapper.cs
- DeploymentExceptionMapper.cs
- x509utils.cs
- ComponentGlyph.cs
- login.cs
- ProcessInfo.cs
- NotifyIcon.cs
- ConfigXmlWhitespace.cs
- FontStyle.cs
- CloudCollection.cs
- CursorInteropHelper.cs
- ImageSourceValueSerializer.cs
- RuntimeConfig.cs
- TemplateField.cs
- CryptoApi.cs
- ImplicitInputBrush.cs
- XmlValueConverter.cs
- EventDescriptor.cs
- ModifiableIteratorCollection.cs
- AdornerDecorator.cs
- XamlPoint3DCollectionSerializer.cs
- DataConnectionHelper.cs
- rsa.cs
- RowToFieldTransformer.cs
- QilList.cs
- validation.cs
- ItemCheckEvent.cs
- Simplifier.cs
- HttpModuleCollection.cs
- WebPartAddingEventArgs.cs
- Codec.cs
- EditorPartCollection.cs
- MissingMemberException.cs
- SplitterPanel.cs
- BevelBitmapEffect.cs
- EditingMode.cs
- xsdvalidator.cs
- WebPartExportVerb.cs
- StoreAnnotationsMap.cs
- BinHexDecoder.cs
- TableProviderWrapper.cs
- FileDataSourceCache.cs
- StaticSiteMapProvider.cs
- ValidationHelper.cs
- PageAsyncTaskManager.cs
- EncodingNLS.cs
- PeerInputChannelListener.cs
- ModelUIElement3D.cs
- ListViewUpdatedEventArgs.cs
- MiniConstructorInfo.cs
- TableCell.cs
- DataListCommandEventArgs.cs
- ApplicationException.cs
- CreateUserWizardStep.cs
- TraceLog.cs
- FlowLayout.cs
- RenamedEventArgs.cs
- DropDownHolder.cs
- ExtractCollection.cs
- DataGridViewColumnConverter.cs
- VisualTreeUtils.cs
- EdgeModeValidation.cs
- XmlSchemaSimpleTypeList.cs
- NullableConverter.cs
- VectorCollection.cs
- XmlEntityReference.cs
- DataGridViewColumnCollectionDialog.cs
- ArithmeticException.cs
- MenuItem.cs
- PopupRoot.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- Focus.cs
- DesignerActionList.cs
- PostBackTrigger.cs
- Translator.cs
- Splitter.cs
- TrustLevel.cs
- DurableInstanceProvider.cs
- ProfileParameter.cs
- Vector.cs
- BitmapFrame.cs
- TriState.cs
- XmlQueryTypeFactory.cs
- serverconfig.cs
- SafeBitVector32.cs
- ConfigXmlCDataSection.cs
- Debug.cs
- DecoderFallback.cs
- Header.cs