Code:
/ DotNET / DotNET / 8.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
- DrawingContext.cs
- CqlWriter.cs
- RelatedCurrencyManager.cs
- AccessViolationException.cs
- WindowsTitleBar.cs
- InvalidCastException.cs
- CryptoKeySecurity.cs
- GeneralTransform3DTo2D.cs
- InternalException.cs
- ConditionValidator.cs
- DataGridColumnEventArgs.cs
- ToolStripRenderer.cs
- SingleAnimationBase.cs
- ScriptControlDescriptor.cs
- IIS7UserPrincipal.cs
- UncommonField.cs
- FontSizeConverter.cs
- SettingsAttributes.cs
- HttpStreams.cs
- PenThread.cs
- MemberProjectionIndex.cs
- CompModSwitches.cs
- Processor.cs
- serverconfig.cs
- HuffmanTree.cs
- DataSysAttribute.cs
- AttachedPropertyBrowsableAttribute.cs
- Soap12ProtocolImporter.cs
- BaseHashHelper.cs
- ValidatorCollection.cs
- SizeConverter.cs
- SystemIcons.cs
- processwaithandle.cs
- UrlPath.cs
- _AuthenticationState.cs
- NamespaceDecl.cs
- InputEventArgs.cs
- AppLevelCompilationSectionCache.cs
- BindingCollection.cs
- EmptyElement.cs
- XamlTemplateSerializer.cs
- DbDataRecord.cs
- Menu.cs
- AdornerPresentationContext.cs
- Propagator.JoinPropagator.cs
- TextRunCacheImp.cs
- SamlAuthorityBinding.cs
- SystemIPInterfaceProperties.cs
- State.cs
- TokenBasedSet.cs
- DynamicDocumentPaginator.cs
- StdValidatorsAndConverters.cs
- StorageComplexPropertyMapping.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- XmlObjectSerializerWriteContextComplex.cs
- XamlFilter.cs
- LocalizedNameDescriptionPair.cs
- ChtmlCalendarAdapter.cs
- SqlConnectionPoolProviderInfo.cs
- LazyLoadBehavior.cs
- CFGGrammar.cs
- ContainsRowNumberChecker.cs
- InvalidFilterCriteriaException.cs
- CollectionViewGroupInternal.cs
- X509Utils.cs
- SettingsAttributes.cs
- _ContextAwareResult.cs
- MgmtConfigurationRecord.cs
- StyleHelper.cs
- ImageDrawing.cs
- ListItemCollection.cs
- MsmqAppDomainProtocolHandler.cs
- DBCSCodePageEncoding.cs
- EventToken.cs
- RecordConverter.cs
- X509AudioLogo.cs
- UInt64.cs
- LabelLiteral.cs
- SignedXml.cs
- DeviceContext.cs
- Int64Converter.cs
- Sequence.cs
- DataGridColumn.cs
- TransformerTypeCollection.cs
- WebPartChrome.cs
- TargetFrameworkUtil.cs
- WeakReference.cs
- NamedObject.cs
- ConfigurationProviderException.cs
- Size3D.cs
- WindowsTokenRoleProvider.cs
- PEFileEvidenceFactory.cs
- WindowsSysHeader.cs
- KeySplineConverter.cs
- InternalDispatchObject.cs
- XsltOutput.cs
- GAC.cs
- CodeDOMUtility.cs
- RegexParser.cs
- Button.cs