Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / HotSpotCollection.cs / 1305376 / 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;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
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.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI;
namespace System.Web.UI.WebControls {
///
/// Collection of HotSpots.
///
[
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableLayoutPanelCellPosition.cs
- mil_commands.cs
- FormCollection.cs
- InputMethod.cs
- Debug.cs
- DbMetaDataCollectionNames.cs
- FragmentQueryKB.cs
- FloatUtil.cs
- WorkflowOperationFault.cs
- ArrangedElement.cs
- DbConvert.cs
- SiteMap.cs
- ValueTypeFixupInfo.cs
- WorkflowServiceOperationListItem.cs
- SharedStream.cs
- RuntimeConfig.cs
- XmlSchemaSimpleTypeList.cs
- Model3D.cs
- SvcMapFileSerializer.cs
- EventWaitHandle.cs
- FamilyMap.cs
- HandleRef.cs
- InputProcessorProfilesLoader.cs
- SimpleType.cs
- SerializationEventsCache.cs
- AsmxEndpointPickerExtension.cs
- CheckableControlBaseAdapter.cs
- XmlILAnnotation.cs
- CheckBox.cs
- dataprotectionpermissionattribute.cs
- TemporaryBitmapFile.cs
- XmlDomTextWriter.cs
- HostingEnvironmentSection.cs
- PrimaryKeyTypeConverter.cs
- InstancePersistenceCommandException.cs
- ParameterInfo.cs
- ItemCheckedEvent.cs
- WindowsGrip.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- QueryCursorEventArgs.cs
- EnumConverter.cs
- WmpBitmapEncoder.cs
- PopupControlService.cs
- SpeakInfo.cs
- PropertyChangedEventManager.cs
- TargetControlTypeCache.cs
- InkCanvas.cs
- Missing.cs
- SRGSCompiler.cs
- Unit.cs
- OracleString.cs
- EntityType.cs
- EventsTab.cs
- ImportStoreException.cs
- NativeMethods.cs
- TextCharacters.cs
- XmlElementList.cs
- OrderedDictionary.cs
- PropertyOverridesTypeEditor.cs
- LocalBuilder.cs
- RichTextBox.cs
- EncodedStreamFactory.cs
- FontFamily.cs
- ConstraintEnumerator.cs
- InputChannelAcceptor.cs
- ThemeableAttribute.cs
- CodeNamespaceImportCollection.cs
- WebReference.cs
- PseudoWebRequest.cs
- HttpCapabilitiesSectionHandler.cs
- wpf-etw.cs
- WindowsFormsLinkLabel.cs
- ConfigurationSectionGroupCollection.cs
- _SecureChannel.cs
- XmlMemberMapping.cs
- AsyncDataRequest.cs
- SHA384Managed.cs
- CursorConverter.cs
- FtpCachePolicyElement.cs
- DrawItemEvent.cs
- GridViewDeletedEventArgs.cs
- SecurityRequiresReviewAttribute.cs
- InvokeMethodActivity.cs
- documentsequencetextview.cs
- XhtmlBasicPanelAdapter.cs
- BamlBinaryReader.cs
- SmiGettersStream.cs
- Function.cs
- OrderedDictionaryStateHelper.cs
- TemplateKeyConverter.cs
- SystemIPv6InterfaceProperties.cs
- ConditionalBranch.cs
- MemberRestriction.cs
- Transform3DCollection.cs
- XmlSchemaImport.cs
- IntranetCredentialPolicy.cs
- DbConnectionPoolGroupProviderInfo.cs
- _ProxyChain.cs
- ProcessHost.cs
- NamespaceInfo.cs