// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (c) 2004 Novell, Inc.
+// Copyright (c) 2004-2005 Novell, Inc.
//
// Authors:
// Peter Bartok pbartok@novell.com
using System.Drawing.Imaging;
namespace System.Windows.Forms {
+ [DefaultProperty("Images")]
+ [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design)]
+ [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
+ [TypeConverter("System.Windows.Forms.ImageListConverter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public sealed class ImageList : System.ComponentModel.Component {
#region Local Variables
private ColorDepth color_depth;
#endregion // Local Variables
#region Sub-classes
+ [Editor("System.Windows.Forms.Design.ImageCollectionEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
public sealed class ImageCollection : IList, ICollection, IEnumerable {
#region ImageCollection Local Variables
private ImageList owner;
#endregion // ImageCollection Private Constructor
#region ImageCollection Public Instance Properties
+ [Browsable(false)]
public int Count {
get {
return list.Count;
}
}
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Image this[int index] {
get {
if (index<0 || index>=list.Count) {
case ColorDepth.Depth8Bit: format=PixelFormat.Format8bppIndexed; break;
case ColorDepth.Depth16Bit: format=PixelFormat.Format16bppRgb555; break;
case ColorDepth.Depth24Bit: format=PixelFormat.Format24bppRgb; break;
- case ColorDepth.Depth32Bit: format=PixelFormat.Format32bppRgb; break;
- default: format=PixelFormat.Format32bppRgb; break;
+ case ColorDepth.Depth32Bit: format=PixelFormat.Format32bppArgb; break;
+ default: format=PixelFormat.Format32bppArgb; break;
}
// Check if we can add straight or if we have to resize
reformatted_image = new Bitmap(width, height, format);
g=Graphics.FromImage(reformatted_image);
- g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, width, height, GraphicsUnit.Pixel);
+ g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
g.Dispose();
return list.Add(reformatted_image);
public ImageList(System.ComponentModel.IContainer container) : this ()
{
+ color_depth = ColorDepth.Depth8Bit;
+ transparency_color = Color.Transparent;
+ size = new Size(16, 16);
container.Add (this);
}
#endregion // Public Constructors
#region Public Instance Properties
+ [DefaultValue(ColorDepth.Depth8Bit)]
public ColorDepth ColorDepth {
get {
return this.color_depth;
}
[MonoTODO("Determine if we support HBITMAP handles, this would involve XplatUI")]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IntPtr Handle {
get {
if (RecreateHandle!=null) RecreateHandle(this, EventArgs.Empty);
}
[MonoTODO("Determine if we support HBITMAP handles, this would involve XplatUI")]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool HandleCreated {
get {
return false;
}
}
+ [DefaultValue(null)]
+ [MergableProperty(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ImageCollection Images {
get {
return this.image_collection;
}
}
+ [Localizable(true)]
public Size ImageSize {
get {
return this.size;
}
}
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
public ImageListStreamer ImageStream {
get {
return image_stream;
set {
image_stream = value;
+
+ size = image_stream.ImageSize;
+ color_depth = image_stream.ImageColorDepth;
+ transparency_color = image_stream.BackColor;
+
+ image_collection.Clear ();
+
+ foreach (Image image in image_stream.Images)
+ image_collection.Add (image);
}
}
#endregion // Protected Instance Methods
#region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler RecreateHandle;
#endregion // Events
}