1 //-------------------------------------------------------------
2 // <copyright company=’Microsoft Corporation’>
3 // Copyright © Microsoft Corporation. All Rights Reserved.
5 //-------------------------------------------------------------
6 // @owner=alexgor, deliant
7 //=================================================================
8 // File: NamedImagesCollection.cs
10 // Namespace: System.Windows.Forms.DataVisualization.Charting.ChartTypes
12 // Classes: NamedImagesCollection, NamedImage
14 // Purpose: Every property in the chart references images by names.
15 // This means that you can set MarkerImage property to a
16 // full image path or URL. In case when the user wants to
17 // dynamically generate an image or load it from other
18 // location (like database) you can use named image
19 // collection which is exposed as Images property of the
20 // chart. Any Image can be added to this collection with
21 // unique name and than this name can be used in all the
22 // chart properties which require image names.
24 // Reviewed: AG - Microsoft 14, 2007
26 //===================================================================
28 #region Used namespaces
31 using System
.Collections
;
33 using System
.ComponentModel
;
34 using System
.Globalization
;
35 using System
.Reflection
;
36 using System
.ComponentModel
.Design
.Serialization
;
41 namespace System
.Windows
.Forms
.DataVisualization
.Charting
43 namespace System
.Web
.UI
.DataVisualization
.Charting
47 /// The NamedImagesCollection class is a strongly typed collection of NamedImage
51 [AspNetHostingPermission(System
.Security
.Permissions
.SecurityAction
.InheritanceDemand
, Level
= AspNetHostingPermissionLevel
.Minimal
)]
52 [AspNetHostingPermission(System
.Security
.Permissions
.SecurityAction
.LinkDemand
, Level
= AspNetHostingPermissionLevel
.Minimal
)]
54 public class NamedImagesCollection
: ChartNamedElementCollection
<NamedImage
>
61 internal NamedImagesCollection() : base(null)
70 /// The NamedImage class stores a single Image with its unique name.
73 SRDescription("DescriptionAttributeNamedImage_NamedImage"),
74 DefaultProperty("Name"),
77 [AspNetHostingPermission(System
.Security
.Permissions
.SecurityAction
.InheritanceDemand
, Level
= AspNetHostingPermissionLevel
.Minimal
)]
78 [AspNetHostingPermission(System
.Security
.Permissions
.SecurityAction
.LinkDemand
, Level
= AspNetHostingPermissionLevel
.Minimal
)]
80 public class NamedImage
: ChartNamedElement
84 private string _name
= string.Empty
;
85 private System
.Drawing
.Image _image
= null;
92 /// NamedImage constructor.
99 /// NamedImage constructor.
101 /// <param name="name">Image name.</param>
102 /// <param name="image">Image object.</param>
103 public NamedImage(string name
, System
.Drawing
.Image image
)
114 /// Gets or sets the image name.
118 SRDescription("DescriptionAttributeNamedImage_Name"),
120 public override string Name
133 /// Gets or sets the image object.
137 SRDescription("DescriptionAttributeNamedImage_Image"),
139 public System
.Drawing
.Image Image
154 #region IDisposable Members
156 /// Releases unmanaged and - optionally - managed resources
158 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
159 protected override void Dispose(bool disposing
)
163 // Dispose managed resources
170 base.Dispose(disposing
);