Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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();
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MediaTimeline.cs
- CompositeActivityTypeDescriptor.cs
- ListManagerBindingsCollection.cs
- Type.cs
- UshortList2.cs
- RadioButton.cs
- WebPartConnectionsEventArgs.cs
- StringKeyFrameCollection.cs
- DispatchWrapper.cs
- DriveNotFoundException.cs
- MappingModelBuildProvider.cs
- DataGridTextBoxColumn.cs
- CanonicalXml.cs
- Connection.cs
- XmlDictionaryString.cs
- HtmlShim.cs
- SynchronizedDispatch.cs
- DataGridViewSelectedColumnCollection.cs
- PropertyGrid.cs
- ListMarkerSourceInfo.cs
- Automation.cs
- TableCellAutomationPeer.cs
- ServerTooBusyException.cs
- MethodToken.cs
- XmlSchemaSequence.cs
- XAMLParseException.cs
- QueryableFilterUserControl.cs
- NavigationExpr.cs
- SimpleTextLine.cs
- SoapElementAttribute.cs
- SmtpNtlmAuthenticationModule.cs
- PageAsyncTask.cs
- SurrogateChar.cs
- Camera.cs
- XmlSerializationReader.cs
- _AutoWebProxyScriptEngine.cs
- TextPenaltyModule.cs
- FormClosingEvent.cs
- ListBoxAutomationPeer.cs
- ArgumentNullException.cs
- MailAddress.cs
- ReadOnlyObservableCollection.cs
- RadioButtonAutomationPeer.cs
- DataRelationCollection.cs
- GenericsInstances.cs
- Memoizer.cs
- BitmapSourceSafeMILHandle.cs
- PrintPreviewControl.cs
- PathGradientBrush.cs
- TypeSystemHelpers.cs
- ContainerAction.cs
- SoapReflectionImporter.cs
- SamlAuthorizationDecisionStatement.cs
- _BufferOffsetSize.cs
- DataGridPagingPage.cs
- SessionStateContainer.cs
- MetadataSet.cs
- SpeechAudioFormatInfo.cs
- UnsafePeerToPeerMethods.cs
- SystemWebCachingSectionGroup.cs
- DataDesignUtil.cs
- LinearGradientBrush.cs
- Pen.cs
- DataColumnChangeEvent.cs
- PropertyKey.cs
- ActivityCodeDomSerializer.cs
- SqlXml.cs
- WorkflowViewService.cs
- FormViewPageEventArgs.cs
- MultipleViewProviderWrapper.cs
- ResourceCodeDomSerializer.cs
- SrgsDocument.cs
- PermissionRequestEvidence.cs
- EllipticalNodeOperations.cs
- ErasingStroke.cs
- MostlySingletonList.cs
- dataprotectionpermission.cs
- StrongNameIdentityPermission.cs
- recordstate.cs
- BitmapSizeOptions.cs
- SafeBitVector32.cs
- GlyphInfoList.cs
- PrePrepareMethodAttribute.cs
- AuthenticatedStream.cs
- TextFormatterContext.cs
- ArrangedElement.cs
- HttpAsyncResult.cs
- MimeBasePart.cs
- UIPermission.cs
- PropertyConverter.cs
- XmlSchemaResource.cs
- FontWeights.cs
- XmlDesignerDataSourceView.cs
- SolidBrush.cs
- BinaryEditor.cs
- Ref.cs
- PeerNameRegistration.cs
- SmtpDigestAuthenticationModule.cs
- ErrorStyle.cs
- ConnectionManagementElement.cs