Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / HotSpotCollection.cs / 1 / HotSpotCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
using System.Security.Permissions;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class HotSpotCollection : StateManagedCollection {
private static readonly Type[] knownTypes = new Type[] {
typeof(CircleHotSpot),
typeof(RectangleHotSpot),
typeof(PolygonHotSpot),
};
///
/// Returns the HotSpot at a given index.
///
public HotSpot this[int index] {
get {
return (HotSpot)((IList)this)[index];
}
}
///
/// Adds a HotSpot to the collection.
///
public int Add(HotSpot spot) {
return ((IList)this).Add(spot);
}
///
/// Creates a known type of HotSpot.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new CircleHotSpot();
case 1:
return new RectangleHotSpot();
case 2:
return new PolygonHotSpot();
default:
throw new ArgumentOutOfRangeException(SR.GetString(SR.HotSpotCollection_InvalidTypeIndex));
}
}
///
/// Returns an ArrayList of known HotSpot types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Inserts a HotSpot into the collection.
///
public void Insert(int index, HotSpot spot) {
((IList)this).Insert(index, spot);
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is HotSpot))
throw new ArgumentException(SR.GetString(SR.HotSpotCollection_InvalidType));
}
///
/// Removes a HotSpot from the collection.
///
public void Remove(HotSpot spot) {
((IList)this).Remove(spot);
}
///
/// Removes a HotSpot from the collection at a given index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Marks a HotSpot as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((HotSpot)o).SetDirty();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
using System.Security.Permissions;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class HotSpotCollection : StateManagedCollection {
private static readonly Type[] knownTypes = new Type[] {
typeof(CircleHotSpot),
typeof(RectangleHotSpot),
typeof(PolygonHotSpot),
};
///
/// Returns the HotSpot at a given index.
///
public HotSpot this[int index] {
get {
return (HotSpot)((IList)this)[index];
}
}
///
/// Adds a HotSpot to the collection.
///
public int Add(HotSpot spot) {
return ((IList)this).Add(spot);
}
///
/// Creates a known type of HotSpot.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new CircleHotSpot();
case 1:
return new RectangleHotSpot();
case 2:
return new PolygonHotSpot();
default:
throw new ArgumentOutOfRangeException(SR.GetString(SR.HotSpotCollection_InvalidTypeIndex));
}
}
///
/// Returns an ArrayList of known HotSpot types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Inserts a HotSpot into the collection.
///
public void Insert(int index, HotSpot spot) {
((IList)this).Insert(index, spot);
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is HotSpot))
throw new ArgumentException(SR.GetString(SR.HotSpotCollection_InvalidType));
}
///
/// Removes a HotSpot from the collection.
///
public void Remove(HotSpot spot) {
((IList)this).Remove(spot);
}
///
/// Removes a HotSpot from the collection at a given index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Marks a HotSpot as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((HotSpot)o).SetDirty();
}
}
}
// 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
- IndexExpression.cs
- GridViewRow.cs
- ControlIdConverter.cs
- SamlConditions.cs
- BinHexEncoder.cs
- ExtractorMetadata.cs
- SafePEFileHandle.cs
- JournalNavigationScope.cs
- ScriptResourceInfo.cs
- AnimationClockResource.cs
- XmlnsCache.cs
- GB18030Encoding.cs
- SoapTypeAttribute.cs
- AffineTransform3D.cs
- WebPartCloseVerb.cs
- GridViewRow.cs
- ClientTarget.cs
- PolyBezierSegment.cs
- EntityContainer.cs
- BufferedGraphics.cs
- TextView.cs
- DomainConstraint.cs
- PagesChangedEventArgs.cs
- AssemblyHash.cs
- _ConnectionGroup.cs
- CompareInfo.cs
- BlurBitmapEffect.cs
- WebPartAddingEventArgs.cs
- GeometryGroup.cs
- TranslateTransform.cs
- RegexCompiler.cs
- BamlResourceSerializer.cs
- ByteViewer.cs
- Cloud.cs
- LockCookie.cs
- ReferentialConstraintRoleElement.cs
- DynamicActionMessageFilter.cs
- SqlVisitor.cs
- TemplatedEditableDesignerRegion.cs
- AccessedThroughPropertyAttribute.cs
- PropertySet.cs
- CustomActivityDesigner.cs
- ControlTemplate.cs
- PerformanceCounterCategory.cs
- SecurityDocument.cs
- XsdBuildProvider.cs
- ExpressionBuilderContext.cs
- TextSelectionHighlightLayer.cs
- DoWhileDesigner.xaml.cs
- LongMinMaxAggregationOperator.cs
- ItemCheckedEvent.cs
- HMACSHA384.cs
- ChangeBlockUndoRecord.cs
- RefreshEventArgs.cs
- HyperLinkField.cs
- CodeArrayIndexerExpression.cs
- Cursors.cs
- RenderingEventArgs.cs
- UInt32.cs
- TemplatedEditableDesignerRegion.cs
- GridSplitterAutomationPeer.cs
- FilteredSchemaElementLookUpTable.cs
- FormViewCommandEventArgs.cs
- TextDecoration.cs
- XamlReader.cs
- LateBoundChannelParameterCollection.cs
- IDReferencePropertyAttribute.cs
- CodeDirectoryCompiler.cs
- CroppedBitmap.cs
- EncryptedXml.cs
- dataprotectionpermission.cs
- ModifiableIteratorCollection.cs
- StopStoryboard.cs
- RbTree.cs
- Symbol.cs
- LifetimeServices.cs
- FacetChecker.cs
- CodeTypeParameter.cs
- Knowncolors.cs
- JulianCalendar.cs
- ComponentRenameEvent.cs
- BooleanAnimationBase.cs
- BitmapMetadataBlob.cs
- LongValidator.cs
- SqlPersistenceProviderFactory.cs
- GridViewCellAutomationPeer.cs
- ImageClickEventArgs.cs
- ConfigurationSchemaErrors.cs
- FormClosedEvent.cs
- DataGridClipboardHelper.cs
- Expressions.cs
- Color.cs
- Crypto.cs
- ArgumentException.cs
- TimeoutHelper.cs
- TdsParserSessionPool.cs
- PointIndependentAnimationStorage.cs
- EmptyEnumerator.cs
- TableCell.cs