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
- ToolStripControlHost.cs
- ThicknessConverter.cs
- RecognizerStateChangedEventArgs.cs
- SurrogateEncoder.cs
- ObjectHandle.cs
- PropertyGridEditorPart.cs
- XmlDownloadManager.cs
- DataViewManager.cs
- SelectionItemPattern.cs
- XmlNodeComparer.cs
- InertiaTranslationBehavior.cs
- StackSpiller.Temps.cs
- Double.cs
- Focus.cs
- DataGridViewRowsAddedEventArgs.cs
- RandomNumberGenerator.cs
- TransformDescriptor.cs
- ComplexLine.cs
- Line.cs
- DataGridViewCellConverter.cs
- CollectionCodeDomSerializer.cs
- CustomWebEventKey.cs
- XmlDownloadManager.cs
- OSFeature.cs
- CharStorage.cs
- ListViewUpdateEventArgs.cs
- CapabilitiesUse.cs
- TcpSocketManager.cs
- DiscoveryEndpoint.cs
- DescendantOverDescendantQuery.cs
- IntegerValidator.cs
- UnmanagedHandle.cs
- DocumentSequence.cs
- GenericPrincipal.cs
- WebPartAddingEventArgs.cs
- DiagnosticTraceSource.cs
- XmlReader.cs
- Part.cs
- WorkflowTransactionOptions.cs
- ProfileManager.cs
- Converter.cs
- formatter.cs
- XmlSchemaDocumentation.cs
- SerTrace.cs
- PathFigureCollection.cs
- ParameterToken.cs
- UnmanagedMemoryStream.cs
- Cursor.cs
- DataStorage.cs
- ExtendedTransformFactory.cs
- EventHandlersStore.cs
- COM2ExtendedTypeConverter.cs
- XamlStyleSerializer.cs
- UrlAuthorizationModule.cs
- AccessDataSourceView.cs
- IconBitmapDecoder.cs
- AdornedElementPlaceholder.cs
- OdbcConnectionFactory.cs
- TemplateControlBuildProvider.cs
- DependencyPropertyConverter.cs
- PermissionSet.cs
- WebProxyScriptElement.cs
- AggregateException.cs
- RelatedImageListAttribute.cs
- DetailsViewPagerRow.cs
- WebPartVerbCollection.cs
- TextComposition.cs
- DataGrid.cs
- AppDomainProtocolHandler.cs
- BinaryObjectReader.cs
- OleDbFactory.cs
- AnonymousIdentificationSection.cs
- DecimalFormatter.cs
- SQLDecimal.cs
- BoundPropertyEntry.cs
- VectorCollectionValueSerializer.cs
- TextTreeUndo.cs
- ServerValidateEventArgs.cs
- GridViewColumnCollectionChangedEventArgs.cs
- NextPreviousPagerField.cs
- BindingExpressionUncommonField.cs
- Module.cs
- SafeReversePInvokeHandle.cs
- SqlWorkflowInstanceStoreLock.cs
- StrongTypingException.cs
- ClientBuildManager.cs
- LOSFormatter.cs
- CannotUnloadAppDomainException.cs
- ModifyActivitiesPropertyDescriptor.cs
- XmlCountingReader.cs
- RunClient.cs
- CroppedBitmap.cs
- _BufferOffsetSize.cs
- metrodevice.cs
- ICspAsymmetricAlgorithm.cs
- EnglishPluralizationService.cs
- Queue.cs
- DataRelationCollection.cs
- XmlSchemaType.cs
- Vector3DCollection.cs