2 // System.Windows.Forms.ImageList.cs
5 // Peter Bartok <pbartok@novell.com>
6 // Kornél Pál <http://www.kornelpal.hu/>
8 // Copyright (C) 2004-2005 Novell, Inc.
9 // Copyright (C) 2005 Kornél Pál
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 // Differences between MS.NET ImageList and this implementation:
38 // This is a fully managed image list implementation.
40 // Images are stored as Format32bppArgb internally but ColorDepth is applied
41 // to the colors of images. Images[index] returns a Format32bppArgb copy of
42 // the image so this difference is only internal.
44 // MS.NET has no alpha channel support (except for icons in 32-bit mode with
45 // comctl32.dll version 6.0) but this implementation has full alpha channel
46 // support in 32-bit mode.
48 // Handle should be an HIMAGELIST returned by ImageList_Create. This
49 // implementation uses (IntPtr)(-1) that is a non-zero but invalid handle.
51 // MS.NET destroys handles using the garbage collector this implementation
52 // does the same with Image objects stored in an ArrayList.
54 // MS.NET 1.x shares the same HIMAGELIST between ImageLists that were
55 // initialized from the same ImageListStreamer and doesn't update ImageSize
56 // and ColorDepth that are treated as bugs and MS.NET 2.0 behavior is
59 // MS.NET 2.0 initializes TransparentColor to Color.Transparent in
60 // constructors but ResetTransparentColor and ShouldSerializeTransparentColor
61 // default to Color.LightGray that is treated as a bug.
63 // MS.NET 2.0 does not clear keys when handle is destroyed that is treated as
67 using System.Collections;
68 using System.Collections.Specialized;
69 using System.ComponentModel;
70 using System.ComponentModel.Design.Serialization;
72 using System.Drawing.Design;
73 using System.Drawing.Imaging;
74 using System.Globalization;
75 using System.Runtime.InteropServices;
77 namespace System.Windows.Forms
79 [DefaultProperty("Images")]
80 [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design)]
82 [DesignerSerializer("System.Windows.Forms.Design.ImageListCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
84 [ToolboxItemFilter("System.Windows.Forms")]
85 [TypeConverter(typeof(ImageListConverter))]
86 public sealed class ImageList : System.ComponentModel.Component
88 #region Private Fields
89 private const ColorDepth DefaultColorDepth = ColorDepth.Depth8Bit;
90 private static readonly Size DefaultImageSize = new Size(16, 16);
91 private static readonly Color DefaultTransparentColor = Color.Transparent;
96 private readonly ImageCollection images;
97 #endregion // Private Fields
100 [Editor("System.Windows.Forms.Design.ImageCollectionEditor, " + Consts.AssemblySystem_Design, typeof(UITypeEditor))]
101 public sealed class ImageCollection : IList, ICollection, IEnumerable
103 private const int AlphaMask = unchecked((int)0xFF000000);
111 class IndexedColorDepths
114 private IndexedColorDepths()
118 internal static readonly ColorPalette Palette4Bit;
119 internal static readonly ColorPalette Palette8Bit;
120 private static readonly int[] squares;
122 static IndexedColorDepths()
127 bitmap = new Bitmap(1, 1, PixelFormat.Format4bppIndexed);
128 Palette4Bit = bitmap.Palette;
131 bitmap = new Bitmap(1, 1, PixelFormat.Format8bppIndexed);
132 Palette8Bit = bitmap.Palette;
135 squares = new int[511];
136 for (index = 0; index < 256; index++)
137 squares[255 + index] = squares[255 - index] = index * index;
140 internal static int GetNearestColor(Color[] palette, int color)
151 count = palette.Length;
152 for (index = 0; index < count; index++)
153 if (palette[index].ToArgb() == color)
156 red = unchecked((int)(unchecked((uint)color) >> 16) & 0xFF);
157 green = unchecked((int)(unchecked((uint)color) >> 8) & 0xFF);
159 nearestColor = AlphaMask;
160 minDistance = int.MaxValue;
162 for (index = 0; index < count; index++)
163 if ((distance = squares[255 + palette[index].R - red] + squares[255 + palette[index].G - green] + squares[255 + palette[index].B - blue]) < minDistance) {
164 nearestColor = palette[index].ToArgb();
165 minDistance = distance;
173 private enum ItemFlags
176 UseTransparentColor = 1,
180 private sealed class ImageListItem
182 internal readonly object Image;
183 internal readonly ItemFlags Flags;
184 internal readonly Color TransparentColor;
185 internal readonly int ImageCount = 1;
187 internal ImageListItem(Icon value)
190 throw new ArgumentNullException("value");
193 this.Image = (Icon)value.Clone();
196 internal ImageListItem(Image value)
199 throw new ArgumentNullException("value");
201 if (!(value is Bitmap))
202 throw new ArgumentException("Image must be a Bitmap.");
204 // Images are not cloned.
208 internal ImageListItem(Image value, Color transparentColor) : this(value)
210 this.Flags = ItemFlags.UseTransparentColor;
211 this.TransparentColor = transparentColor;
214 internal ImageListItem(Image value, int imageCount) : this(value)
216 this.Flags = ItemFlags.ImageStrip;
217 this.ImageCount = imageCount;
221 #region ImageCollection Private Fields
222 private ColorDepth colorDepth = DefaultColorDepth;
223 private Size imageSize = DefaultImageSize;
224 private Color transparentColor = DefaultTransparentColor;
225 private ArrayList list = new ArrayList();
227 private ArrayList keys = new ArrayList();
230 private bool handleCreated;
232 private int lastKeyIndex = -1;
234 private readonly ImageList owner;
235 #endregion // ImageCollection Private Fields
237 #region ImageCollection Internal Constructors
238 // For use in ImageList
239 internal ImageCollection(ImageList owner)
243 #endregion // ImageCollection Internal Constructor
245 #region ImageCollection Internal Instance Properties
246 // For use in ImageList
247 internal ColorDepth ColorDepth {
249 return this.colorDepth;
253 if (!Enum.IsDefined(typeof(ColorDepth), value))
254 throw new InvalidEnumArgumentException("value", (int)value, typeof(ColorDepth));
256 if (this.colorDepth != value) {
257 this.colorDepth = value;
263 // For use in ImageList
264 internal IntPtr Handle {
271 // For use in ImageList
272 internal bool HandleCreated {
274 return this.handleCreated;
278 // For use in ImageList
279 internal Size ImageSize {
281 return this.imageSize;
285 if (value.Width < 1 || value.Width > 256 || value.Height < 1 || value.Height > 256)
286 throw new ArgumentException("ImageSize.Width and Height must be between 1 and 256", "value");
288 if (this.imageSize != value) {
289 this.imageSize = value;
295 // For use in ImageList
296 internal ImageListStreamer ImageStream {
298 return this.Empty ? null : new ImageListStreamer(this);
303 Image[] streamImages;
307 if (this.handleCreated)
313 // Only deserialized ImageListStreamers are used.
314 else if ((streamImages = value.Images) != null) {
315 this.list = new ArrayList(streamImages.Length);
317 this.handleCreated = true;
319 this.keys = new ArrayList(streamImages.Length);
322 for (index = 0; index < streamImages.Length; index++) {
323 list.Add((Image)streamImages[index].Clone());
329 // Invalid ColorDepth values are ignored.
330 if (Enum.IsDefined(typeof(ColorDepth), value.ColorDepth))
331 this.colorDepth = (ColorDepth)value.ColorDepth;
332 this.imageSize = value.ImageSize;
335 // Event is raised even when handle was not created yet.
336 owner.OnRecreateHandle();
342 // For use in ImageList
343 internal Color TransparentColor {
345 return this.transparentColor;
349 this.transparentColor = value;
352 #endregion // ImageCollection Internal Instance Properties
354 #region ImageCollection Public Instance Properties
358 return this.handleCreated ? list.Count : this.count;
364 return this.Count == 0;
368 public bool IsReadOnly {
375 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
376 public Image this[int index] {
378 return (Image)GetImage(index).Clone();
384 if (index < 0 || index >= this.Count)
385 throw new ArgumentOutOfRangeException("index");
388 throw new ArgumentNullException("value");
390 if (!(value is Bitmap))
391 throw new ArgumentException("Image must be a Bitmap.");
393 image = CreateImage(value, this.transparentColor);
400 public Image this[string key] {
404 return (index = IndexOfKey(key)) == -1 ? null : this[index];
408 public StringCollection Keys {
412 StringCollection keyCollection;
414 // Returns all keys even when there are more keys than
415 // images. Null keys are returned as empty strings.
417 keyCollection = new StringCollection();
418 for (index = 0; index < keys.Count; index++)
419 keyCollection.Add(((key = (string)keys[index]) == null || key.Length == 0) ? string.Empty : key);
421 return keyCollection;
425 #endregion // ImageCollection Public Instance Properties
427 #region ImageCollection Private Static Methods
429 private static bool CompareKeys(string key1, string key2)
431 // Keys are case-insensitive and keys with different length
432 // are not equal even when string.Compare treats them equal.
434 if (key1 == null || key2 == null || key1.Length != key2.Length)
437 return string.Compare(key1, key2, true, CultureInfo.InvariantCulture) == 0;
440 #endregion // ImageCollection Private Static Methods
442 #region ImageCollection Private Instance Methods
444 private int AddItem(string key, ImageListItem item)
446 private int AddItem(ImageListItem item)
454 if (this.handleCreated)
455 itemIndex = AddItemInternal(item);
457 // Image strips are counted as a single item in the return
458 // value of Add and AddStrip until handle is created.
460 itemIndex = list.Add(item);
461 this.count += item.ImageCount;
465 if ((item.Flags & ItemFlags.ImageStrip) == 0)
468 for (index = 0; index < item.ImageCount; index++)
475 private int AddItemInternal(ImageListItem item)
477 if (item.Image is Icon) {
483 bitmap = new Bitmap(imageWidth = this.imageSize.Width, imageHeight = this.imageSize.Height, PixelFormat.Format32bppArgb);
484 graphics = Graphics.FromImage(bitmap);
485 graphics.DrawIcon((Icon)item.Image, new Rectangle(0, 0, imageWidth, imageHeight));
488 ReduceColorDepth(bitmap);
489 return list.Add(bitmap);
491 else if ((item.Flags & ItemFlags.ImageStrip) == 0)
492 return list.Add(CreateImage((Image)item.Image, (item.Flags & ItemFlags.UseTransparentColor) == 0 ? this.transparentColor : item.TransparentColor));
503 ImageAttributes imageAttributes;
505 // When ImageSize was changed after adding image strips
506 // Count will return invalid values based on old ImageSize
507 // but when creating handle either ArgumentException will
508 // be thrown or image strip will be added according to the
509 // new ImageSize. This can result in image count
510 // difference that can result in exceptions in methods
511 // that use Count before creating handle. In addition this
512 // can result in the loss of sync with keys. When doing
513 // the same after handle was created there are no problems
514 // as handle will be recreated after changing ImageSize
515 // that results in the loss of images added previously.
517 if ((width = (image = (Image)item.Image).Width) == 0 || (width % (imageWidth = this.imageSize.Width)) != 0)
518 throw new ArgumentException("Width of image strip must be a positive multiple of ImageSize.Width.", "value");
520 if (image.Height != (imageHeight = this.imageSize.Height))
521 throw new ArgumentException("Height of image strip must be equal to ImageSize.Height.", "value");
523 imageRect = new Rectangle(0, 0, imageWidth, imageHeight);
524 if (this.transparentColor.A == 0)
525 imageAttributes = null;
527 imageAttributes = new ImageAttributes();
528 imageAttributes.SetColorKey(this.transparentColor, this.transparentColor);
532 for (imageX = 0; imageX < width; imageX += imageWidth) {
533 bitmap = new Bitmap(imageWidth, imageHeight, PixelFormat.Format32bppArgb);
534 graphics = Graphics.FromImage(bitmap);
535 graphics.DrawImage(image, imageRect, imageX, 0, imageWidth, imageHeight, GraphicsUnit.Pixel, imageAttributes);
538 ReduceColorDepth(bitmap);
542 if (imageAttributes != null)
543 imageAttributes.Dispose();
549 private void CreateHandle()
554 if (!this.handleCreated) {
556 this.list = new ArrayList(this.count);
558 this.handleCreated = true;
560 for (index = 0; index < items.Count; index++)
561 AddItemInternal((ImageListItem)items[index]);
565 private Image CreateImage(Image value, Color transparentColor)
571 ImageAttributes imageAttributes;
573 if (transparentColor.A == 0)
574 imageAttributes = null;
576 imageAttributes = new ImageAttributes();
577 imageAttributes.SetColorKey(transparentColor, transparentColor);
580 bitmap = new Bitmap(imageWidth = this.imageSize.Width, imageHeight = this.imageSize.Height, PixelFormat.Format32bppArgb);
581 graphics = Graphics.FromImage(bitmap);
582 graphics.DrawImage(value, new Rectangle(0, 0, imageWidth, imageHeight), 0, 0, value.Width, value.Height, GraphicsUnit.Pixel, imageAttributes);
585 if (imageAttributes != null)
586 imageAttributes.Dispose();
588 ReduceColorDepth(bitmap);
592 private void RecreateHandle()
594 if (this.handleCreated) {
596 this.handleCreated = true;
597 owner.OnRecreateHandle();
601 private unsafe void ReduceColorDepth(Bitmap bitmap)
611 BitmapData bitmapData;
614 if (this.colorDepth < ColorDepth.Depth32Bit) {
615 bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
617 linePtr = (byte*)bitmapData.Scan0;
618 height = bitmapData.Height;
619 widthBytes = bitmapData.Width << 2;
620 stride = bitmapData.Stride;
622 if (this.colorDepth < ColorDepth.Depth16Bit) {
623 palette = (this.colorDepth < ColorDepth.Depth8Bit ? IndexedColorDepths.Palette4Bit : IndexedColorDepths.Palette8Bit).Entries;
625 for (line = 0; line < height; line++) {
626 lineEndPtr = linePtr + widthBytes;
627 for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
628 *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : IndexedColorDepths.GetNearestColor(palette, pixel | AlphaMask);
632 else if (this.colorDepth < ColorDepth.Depth24Bit) {
633 for (line = 0; line < height; line++) {
634 lineEndPtr = linePtr + widthBytes;
635 for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
636 *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : (pixel & 0x00F8F8F8) | AlphaMask;
641 for (line = 0; line < height; line++) {
642 lineEndPtr = linePtr + widthBytes;
643 for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
644 *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : pixel | AlphaMask;
650 bitmap.UnlockBits(bitmapData);
654 #endregion // ImageCollection Private Instance Methods
656 #region ImageCollection Internal Instance Methods
657 // For use in ImageList
658 internal void DestroyHandle()
660 if (this.handleCreated) {
661 this.list = new ArrayList();
663 this.handleCreated = false;
665 keys = new ArrayList();
670 // For use in ImageList
671 internal Image GetImage(int index)
673 if (index < 0 || index >= this.Count)
674 throw new ArgumentOutOfRangeException("index");
677 return (Image)list[index];
680 // For use in ImageListStreamer
681 internal Image[] ToArray()
685 // Handle is created even when the list is empty.
687 images = new Image[list.Count];
691 #endregion // ImageCollection Internal Instance Methods
693 #region ImageCollection Public Instance Methods
694 public void Add(Icon value)
699 AddItem(new ImageListItem(value));
703 public void Add(Image value)
708 AddItem(new ImageListItem(value));
712 public int Add(Image value, Color transparentColor)
715 return AddItem(null, new ImageListItem(value, transparentColor));
717 return AddItem(new ImageListItem(value, transparentColor));
722 public void Add(string key, Icon icon)
724 // Argument has name icon but exceptions use name value.
725 AddItem(key, new ImageListItem(icon));
728 public void Add(string key, Image image)
730 // Argument has name image but exceptions use name value.
731 AddItem(key, new ImageListItem(image));
734 public void AddRange(Image[] images)
739 throw new ArgumentNullException("images");
741 for (index = 0; index < images.Length; index++)
746 public int AddStrip(Image value)
752 throw new ArgumentNullException("value");
754 if ((width = value.Width) == 0 || (width % (imageWidth = this.imageSize.Width)) != 0)
755 throw new ArgumentException("Width of image strip must be a positive multiple of ImageSize.Width.", "value");
757 if (value.Height != this.imageSize.Height)
758 throw new ArgumentException("Height of image strip must be equal to ImageSize.Height.", "value");
761 return AddItem(null, new ImageListItem(value, width / imageWidth));
763 return AddItem(new ImageListItem(value, width / imageWidth));
770 if (this.handleCreated)
778 [EditorBrowsable(EditorBrowsableState.Never)]
780 public bool Contains(Image image)
782 throw new NotSupportedException();
786 public bool ContainsKey(string key)
788 return IndexOfKey(key) != -1;
792 public IEnumerator GetEnumerator()
794 Image[] images = new Image[this.Count];
797 if (images.Length != 0) {
798 // Handle is created only when there are images.
801 for (index = 0; index < images.Length; index++)
802 images[index] = (Image)((Image)list[index]).Clone();
805 return images.GetEnumerator();
809 [EditorBrowsable(EditorBrowsableState.Never)]
811 public int IndexOf(Image image)
813 throw new NotSupportedException();
817 public int IndexOfKey(string key)
821 if (key != null && key.Length != 0) {
822 // When last IndexOfKey was successful and the same key was
823 // assigned to an image with a lower index than the last
824 // result and the key of the last result equals to key
825 // argument the last result is returned.
827 if (this.lastKeyIndex >= 0 && this.lastKeyIndex < this.Count && CompareKeys((string)keys[this.lastKeyIndex], key))
828 return this.lastKeyIndex;
830 // Duplicate keys are allowed and first match is returned.
831 for (index = 0; index < this.Count; index++)
832 if (CompareKeys((string)keys[index], key))
833 return this.lastKeyIndex = index;
836 return this.lastKeyIndex = -1;
841 [EditorBrowsable(EditorBrowsableState.Never)]
843 public void Remove(Image image)
845 throw new NotSupportedException();
848 public void RemoveAt(int index)
850 if (index < 0 || index >= this.Count)
851 throw new ArgumentOutOfRangeException("index");
854 list.RemoveAt(index);
856 keys.RemoveAt(index);
861 public void RemoveByKey(string key)
865 if ((index = IndexOfKey(key)) != -1)
869 public void SetKeyName(int index, string name)
871 // Only SetKeyName throws IndexOutOfRangeException.
872 if (index < 0 || index >= this.Count)
873 throw new IndexOutOfRangeException();
878 #endregion // ImageCollection Public Instance Methods
880 #region ImageCollection Interface Properties
881 object IList.this[int index] {
887 if (!(value is Image))
888 throw new ArgumentException("value");
890 this[index] = (Image)value;
894 bool IList.IsFixedSize {
900 bool ICollection.IsSynchronized {
906 object ICollection.SyncRoot {
911 #endregion // ImageCollection Interface Properties
913 #region ImageCollection Interface Methods
914 int IList.Add(object value)
918 if (!(value is Image))
919 throw new ArgumentException("value");
922 this.Add((Image)value);
926 bool IList.Contains(object value)
928 return value is Image ? this.Contains((Image)value) : false;
931 int IList.IndexOf(object value)
933 return value is Image ? this.IndexOf((Image)value) : -1;
936 void IList.Insert(int index, object value)
938 throw new NotSupportedException();
941 void IList.Remove(object value)
944 this.Remove((Image)value);
947 void ICollection.CopyTo(Array array, int index)
951 for (imageIndex = 0; imageIndex < this.Count; imageIndex++)
952 array.SetValue(this[index], index++);
954 #endregion // ImageCollection Interface Methods
956 #endregion // Sub-classes
958 #region Public Constructors
961 images = new ImageCollection(this);
964 public ImageList(System.ComponentModel.IContainer container) : this()
968 #endregion // Public Constructors
970 #region Private Instance Methods
971 private void OnRecreateHandle()
973 EventHandler eh = (EventHandler)(Events [RecreateHandleEvent]);
975 eh (this, EventArgs.Empty);
977 #endregion // Private Instance Methods
979 #region Public Instance Properties
981 [DefaultValue(DefaultColorDepth)]
983 public ColorDepth ColorDepth {
985 return images.ColorDepth;
989 images.ColorDepth = value;
994 [EditorBrowsable(EditorBrowsableState.Advanced)]
995 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
996 public IntPtr Handle {
998 return images.Handle;
1003 [EditorBrowsable(EditorBrowsableState.Advanced)]
1004 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
1005 public bool HandleCreated {
1007 return images.HandleCreated;
1011 [DefaultValue(null)]
1012 [MergableProperty(false)]
1013 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
1014 public ImageCollection Images {
1021 public Size ImageSize {
1023 return images.ImageSize;
1027 images.ImageSize = value;
1032 [DefaultValue(null)]
1033 [EditorBrowsable(EditorBrowsableState.Advanced)]
1034 public ImageListStreamer ImageStream {
1036 return images.ImageStream;
1040 images.ImageStream = value;
1046 [DefaultValue(null)]
1047 [Localizable(false)]
1048 [TypeConverter(typeof(StringConverter))]
1060 public Color TransparentColor {
1062 return images.TransparentColor;
1066 images.TransparentColor = value;
1069 #endregion // Public Instance Properties
1071 #region Public Instance Methods
1072 public void Draw(Graphics g, Point pt, int index)
1074 this.Draw(g, pt.X, pt.Y, index);
1077 public void Draw(Graphics g, int x, int y, int index)
1079 g.DrawImage(images.GetImage(index), x, y);
1082 public void Draw(Graphics g, int x, int y, int width, int height, int index)
1084 g.DrawImage(images.GetImage(index), x, y, width, height);
1087 public override string ToString()
1089 return base.ToString() + " Images.Count: " + images.Count.ToString() + ", ImageSize: " + this.ImageSize.ToString();
1091 #endregion // Public Instance Methods
1093 #region Protected Instance Methods
1094 protected override void Dispose(bool disposing)
1097 images.DestroyHandle();
1099 base.Dispose(disposing);
1101 #endregion // Protected Instance Methods
1104 static object RecreateHandleEvent = new object ();
1107 [EditorBrowsable(EditorBrowsableState.Advanced)]
1108 public event EventHandler RecreateHandle {
1109 add { Events.AddHandler (RecreateHandleEvent, value); }
1110 remove { Events.RemoveHandler (RecreateHandleEvent, value); }
1112 #endregion // Events